UNPKG

@tanglemedia/directus-extension-bundle-page-views

Version:

A Directus extension bundle that adds a page views collection and dashboard to track page views.

61 lines (57 loc) 985 B
const COLLECTION_NAME = "tngl_page_views"; // preset that applies to any user or role const PRESETS = [ { bookmark: null, user: null, role: null, collection: COLLECTION_NAME, search: null, layout: null, layout_query: { tabular: { page: 1, sort: ["-date_created"], fields: [ "date_created", "title", "endpoint", "language", "url", "device", "source", "navigation", ], }, }, layout_options: { tabular: { widths: { url: 637.25, area: 596, title: 354, source: 507.5, endpoint: 426, date_created: 283, }, }, }, refresh_interval: 10, filter: null, icon: "bookmark_border", color: null, }, ]; export async function up(knex) { await knex("directus_presets").insert(PRESETS); } export async function down(knex) { await knex("directus_presets") .where({ user: null, role: null, bookmark: null, collection: COLLECTION_NAME, }) .del(); }