@walkeros/web-destination-matomo 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +16 -0
- package/dist/examples/index.mjs +16 -0
- package/dist/walkerOS.json +24 -8
- package/package.json +4 -4
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},n={};o(n,{examples:()=>h,schemas:()=>c}),module.exports=(e=n,((e,o,n,c)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let s of i(o))r.call(e,s)||s===n||t(e,s,{get:()=>o[s],enumerable:!(c=a(o,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c={};o(c,{MappingSchema:()=>m,SettingsSchema:()=>d,mapping:()=>g,settings:()=>u});var s=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),d=p.z.object({siteId:p.z.string().min(1).describe("Matomo Site ID (like 1, 2, etc.)"),url:p.z.string().url().describe("Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)"),disableCookies:p.z.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:p.z.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:p.z.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:p.z.record(p.z.string(),p.z.string()).optional().describe('Custom dimension ID to property path mapping applied to all events (like { "1": "data.userType" })')}),l=require("@walkeros/core/dev"),m=l.z.object({goalId:l.z.string().optional().describe("Goal ID to track a conversion alongside this event (like 1)"),goalValue:l.z.string().optional().describe("Property path for goal revenue value (like data.revenue)"),siteSearch:l.z.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:l.z.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:l.z.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:l.z.record(l.z.string(),l.z.string()).optional().describe('Per-event custom dimension ID to property path mapping (like { "3": "data.category" })')}),u=(0,s.zodToSchema)(d),g=(0,s.zodToSchema)(m),h={};o(h,{env:()=>k,step:()=>b});var k={};o(k,{init:()=>v,push:()=>y,simulation:()=>w});var v={window:{_paq:void 0,location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},y={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},w=["call:window._paq.push"],b={};o(b,{customEvent:()=>S,ecommerceCartUpdate:()=>_,ecommerceOrder:()=>z,goalTracking:()=>O,init:()=>E,pageView:()=>f,productDetailView:()=>I,siteSearch:()=>C});var q=require("@walkeros/core"),E={title:"Initialization",description:"Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",in:{loadScript:!0,settings:{siteId:"1",url:"https://analytics.example.com/"}},out:[["_paq.push",["setTrackerUrl","https://analytics.example.com/matomo.php"]],["_paq.push",["setSiteId","1"]],["_paq.push",["enableLinkTracking"]]]},f={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:(0,q.getEvent)("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},S={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:(0,q.getEvent)("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"goal_1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","goal_1",void 0]]]},z={title:"Ecommerce order",description:"A completed order calls Matomo trackEcommerceOrder with line items and order totals.",in:(0,q.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>(0,q.isObject)(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["_paq.push",["trackEcommerceOrder",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1},{sku:"cc",name:"Cool Cap",category:"",price:42,quantity:1}],{orderId:"0rd3r1d",grandTotal:555,tax:73.76,shipping:5.22}]]]},_={title:"Cart update",description:"A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",in:(0,q.getEvent)("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>(0,q.isObject)(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},"data.value"]}},out:[["_paq.push",["trackEcommerceCartUpdate",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1}],840]]]},I={title:"Product detail view",description:"A product view fires Matomo ecommerceProductDetailView with a single-product array.",in:(0,q.getEvent)("product view",{timestamp:1700000404}),mapping:{name:"ecommerceProductDetailView",data:{set:[{set:[{map:{sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1}}}]}]}},out:[["_paq.push",["ecommerceProductDetailView",[{sku:"ers",name:"Everyday Ruck Snack",price:420,quantity:1}]]]]},C={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:(0,q.getEvent)("search submit",{timestamp:1700000405,data:{query:"shoes",category:"products",resultsCount:42}}),mapping:{name:"trackSiteSearch",settings:{siteSearch:!0},data:{set:["data.query","data.category","data.resultsCount"]}},out:[["_paq.push",["trackSiteSearch","shoes","products",42]]]},O={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:(0,q.getEvent)("promotion visible",{timestamp:1700000406,data:{name:"Setting up tracking easily",position:"hero",value:50}}),mapping:{name:"trackEvent",settings:{goalId:"1",goalValue:"data.value"},data:{set:["data.name"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily"]],["_paq.push",["trackGoal","1",50]]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,kCAAkC;AAAA,EACrE,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,aACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,aACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,aACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,kBAAkB,aACf,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;AChCD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,QAAQ,cACL,OAAO,EACP,SAAS,EACT,SAAS,6DAA6D;AAAA,EACzE,WAAW,cACR,OAAO,EACP,SAAS,EACT,SAAS,0DAA0D;AAAA,EACtE,YAAY,cACT,QAAQ,EACR,SAAS,EACT,SAAS,qDAAqD;AAAA,EACjE,mBAAmB,cAChB,QAAQ,EACR,SAAS,EACT,SAAS,0DAA0D;AAAA,EACtE,oBAAo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AAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;","names":["import_dev","import_dev","init"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n title: 'Ecommerce order',\n description:\n 'A completed order calls Matomo trackEcommerceOrder with line items and order totals.',\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n title: 'Cart update',\n description:\n 'A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n title: 'Product detail view',\n description:\n 'A product view fires Matomo ecommerceProductDetailView with a single-product array.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n title: 'Goal with value',\n description:\n 'A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.',\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,kCAAkC;AAAA,EACrE,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,aACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,aACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,aACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,kBAAkB,aACf,OAAO,aAAE,OAAO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S,iBAAiB;AAAA,IAC5B,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,SAAS,UAAU,YAAY,cAAc,GAAG;AAAA,EACjE,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,YAAY;AAAA,IACd;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,cAAc,iBAAiB,mBAAmB;AAAA,IAC1D;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,aAAa,CAAC,mBAAmB,SAAS,YAAY,EAAE,CAAC,CAAC;AACnE;AAMO,IAAM,eAAiC;AAAA,EAC5C,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,qBAAqB;AAAA,IAChC,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,8BAA8B,UAAU,QAAQ,OAAO,GAAG;AAAA,EAC1E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;","names":["import_dev","import_dev","init"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>c,SettingsSchema:()=>r,mapping:()=>p,settings:()=>s});import{zodToSchema as i}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=o.object({siteId:o.string().min(1).describe("Matomo Site ID (like 1, 2, etc.)"),url:o.string().url().describe("Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)"),disableCookies:o.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:o.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:o.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:o.record(o.string(),o.string()).optional().describe('Custom dimension ID to property path mapping applied to all events (like { "1": "data.userType" })')});import{z as n}from"@walkeros/core/dev";var c=n.object({goalId:n.string().optional().describe("Goal ID to track a conversion alongside this event (like 1)"),goalValue:n.string().optional().describe("Property path for goal revenue value (like data.revenue)"),siteSearch:n.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:n.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:n.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:n.record(n.string(),n.string()).optional().describe('Per-event custom dimension ID to property path mapping (like { "3": "data.category" })')}),s=i(r),p=i(c),d={};t(d,{env:()=>m,step:()=>k});var m={};t(m,{init:()=>l,push:()=>u,simulation:()=>g});var l={window:{_paq:void 0,location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},u={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},g=["call:window._paq.push"],k={};t(k,{customEvent:()=>b,ecommerceCartUpdate:()=>S,ecommerceOrder:()=>f,goalTracking:()=>I,init:()=>y,pageView:()=>w,productDetailView:()=>q,siteSearch:()=>E});import{getEvent as h,isObject as v}from"@walkeros/core";var y={title:"Initialization",description:"Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",in:{loadScript:!0,settings:{siteId:"1",url:"https://analytics.example.com/"}},out:[["_paq.push",["setTrackerUrl","https://analytics.example.com/matomo.php"]],["_paq.push",["setSiteId","1"]],["_paq.push",["enableLinkTracking"]]]},w={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:h("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},b={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:h("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"goal_1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","goal_1",void 0]]]},f={title:"Ecommerce order",description:"A completed order calls Matomo trackEcommerceOrder with line items and order totals.",in:h("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>v(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["_paq.push",["trackEcommerceOrder",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1},{sku:"cc",name:"Cool Cap",category:"",price:42,quantity:1}],{orderId:"0rd3r1d",grandTotal:555,tax:73.76,shipping:5.22}]]]},S={title:"Cart update",description:"A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",in:h("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>v(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},"data.value"]}},out:[["_paq.push",["trackEcommerceCartUpdate",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1}],840]]]},q={title:"Product detail view",description:"A product view fires Matomo ecommerceProductDetailView with a single-product array.",in:h("product view",{timestamp:1700000404}),mapping:{name:"ecommerceProductDetailView",data:{set:[{set:[{map:{sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1}}}]}]}},out:[["_paq.push",["ecommerceProductDetailView",[{sku:"ers",name:"Everyday Ruck Snack",price:420,quantity:1}]]]]},E={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:h("search submit",{timestamp:1700000405,data:{query:"shoes",category:"products",resultsCount:42}}),mapping:{name:"trackSiteSearch",settings:{siteSearch:!0},data:{set:["data.query","data.category","data.resultsCount"]}},out:[["_paq.push",["trackSiteSearch","shoes","products",42]]]},I={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:h("promotion visible",{timestamp:1700000406,data:{name:"Setting up tracking easily",position:"hero",value:50}}),mapping:{name:"trackEvent",settings:{goalId:"1",goalValue:"data.value"},data:{set:["data.name"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily"]],["_paq.push",["trackGoal","1",50]]]};export{d as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,kCAAkC;AAAA,EACrE,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,EACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,EACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,EACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,kBAAkB,EACf,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;AChCD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,QAAQA,GACL,OAAO,EACP,SAAS,EACT,SAAS,6DAA6D;AAAA,EACzE,WAAWA,GACR,OAAO,EACP,SAAS,EACT,SAAS,0DAA0D;AAAA,E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,OAAO,GAAG;AAAA,EAC1E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;","names":["z","init"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n title: 'Ecommerce order',\n description:\n 'A completed order calls Matomo trackEcommerceOrder with line items and order totals.',\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n title: 'Cart update',\n description:\n 'A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n title: 'Product detail view',\n description:\n 'A product view fires Matomo ecommerceProductDetailView with a single-product array.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n title: 'Goal with value',\n description:\n 'A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.',\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,kCAAkC;AAAA,EACrE,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,EACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,EACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,EACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA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,EAC1C,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,iBAAiB;AAAA,IAC5B,WAAW;AAAA,IACX,MAAM,EAAE,OAAO,SAAS,UAAU,YAAY,cAAc,GAAG;AAAA,EACjE,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,YAAY;AAAA,IACd;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,cAAc,iBAAiB,mBAAmB;AAAA,IAC1D;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,aAAa,CAAC,mBAAmB,SAAS,YAAY,EAAE,CAAC,CAAC;AACnE;AAMO,IAAM,eAAiC;AAAA,EAC5C,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,qBAAqB;AAAA,IAChC,WAAW;AAAA,IACX,MAAM,EAAE,MAAM,8BAA8B,UAAU,QAAQ,OAAO,GAAG;AAAA,EAC1E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;","names":["z","init"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -83,6 +83,8 @@ __export(step_exports, {
|
|
|
83
83
|
});
|
|
84
84
|
var import_core = require("@walkeros/core");
|
|
85
85
|
var init2 = {
|
|
86
|
+
title: "Initialization",
|
|
87
|
+
description: "Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",
|
|
86
88
|
in: {
|
|
87
89
|
loadScript: true,
|
|
88
90
|
settings: {
|
|
@@ -100,6 +102,8 @@ var init2 = {
|
|
|
100
102
|
]
|
|
101
103
|
};
|
|
102
104
|
var pageView = {
|
|
105
|
+
title: "Page view",
|
|
106
|
+
description: "A page view is tracked in Matomo via trackPageView with the page title from event data.",
|
|
103
107
|
in: (0, import_core.getEvent)("page view", { timestamp: 1700000400 }),
|
|
104
108
|
mapping: {
|
|
105
109
|
data: "data.title"
|
|
@@ -107,6 +111,8 @@ var pageView = {
|
|
|
107
111
|
out: [["_paq.push", ["trackPageView", "walkerOS documentation"]]]
|
|
108
112
|
};
|
|
109
113
|
var customEvent = {
|
|
114
|
+
title: "Custom event with goal",
|
|
115
|
+
description: "A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",
|
|
110
116
|
in: (0, import_core.getEvent)("promotion visible", { timestamp: 1700000401 }),
|
|
111
117
|
mapping: {
|
|
112
118
|
name: "trackEvent",
|
|
@@ -123,6 +129,8 @@ var customEvent = {
|
|
|
123
129
|
]
|
|
124
130
|
};
|
|
125
131
|
var ecommerceOrder = {
|
|
132
|
+
title: "Ecommerce order",
|
|
133
|
+
description: "A completed order calls Matomo trackEcommerceOrder with line items and order totals.",
|
|
126
134
|
in: (0, import_core.getEvent)("order complete", { timestamp: 1700000402 }),
|
|
127
135
|
mapping: {
|
|
128
136
|
name: "trackEcommerceOrder",
|
|
@@ -186,6 +194,8 @@ var ecommerceOrder = {
|
|
|
186
194
|
]
|
|
187
195
|
};
|
|
188
196
|
var ecommerceCartUpdate = {
|
|
197
|
+
title: "Cart update",
|
|
198
|
+
description: "A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",
|
|
189
199
|
in: (0, import_core.getEvent)("cart view", { timestamp: 1700000403 }),
|
|
190
200
|
mapping: {
|
|
191
201
|
name: "trackEcommerceCartUpdate",
|
|
@@ -230,6 +240,8 @@ var ecommerceCartUpdate = {
|
|
|
230
240
|
]
|
|
231
241
|
};
|
|
232
242
|
var productDetailView = {
|
|
243
|
+
title: "Product detail view",
|
|
244
|
+
description: "A product view fires Matomo ecommerceProductDetailView with a single-product array.",
|
|
233
245
|
in: (0, import_core.getEvent)("product view", { timestamp: 1700000404 }),
|
|
234
246
|
mapping: {
|
|
235
247
|
name: "ecommerceProductDetailView",
|
|
@@ -268,6 +280,8 @@ var productDetailView = {
|
|
|
268
280
|
]
|
|
269
281
|
};
|
|
270
282
|
var siteSearch = {
|
|
283
|
+
title: "Site search",
|
|
284
|
+
description: "A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",
|
|
271
285
|
in: (0, import_core.getEvent)("search submit", {
|
|
272
286
|
timestamp: 1700000405,
|
|
273
287
|
data: { query: "shoes", category: "products", resultsCount: 42 }
|
|
@@ -284,6 +298,8 @@ var siteSearch = {
|
|
|
284
298
|
out: [["_paq.push", ["trackSiteSearch", "shoes", "products", 42]]]
|
|
285
299
|
};
|
|
286
300
|
var goalTracking = {
|
|
301
|
+
title: "Goal with value",
|
|
302
|
+
description: "A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",
|
|
287
303
|
in: (0, import_core.getEvent)("promotion visible", {
|
|
288
304
|
timestamp: 1700000406,
|
|
289
305
|
data: { name: "Setting up tracking easily", position: "hero", value: 50 }
|
package/dist/examples/index.mjs
CHANGED
|
@@ -62,6 +62,8 @@ __export(step_exports, {
|
|
|
62
62
|
});
|
|
63
63
|
import { getEvent, isObject } from "@walkeros/core";
|
|
64
64
|
var init2 = {
|
|
65
|
+
title: "Initialization",
|
|
66
|
+
description: "Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",
|
|
65
67
|
in: {
|
|
66
68
|
loadScript: true,
|
|
67
69
|
settings: {
|
|
@@ -79,6 +81,8 @@ var init2 = {
|
|
|
79
81
|
]
|
|
80
82
|
};
|
|
81
83
|
var pageView = {
|
|
84
|
+
title: "Page view",
|
|
85
|
+
description: "A page view is tracked in Matomo via trackPageView with the page title from event data.",
|
|
82
86
|
in: getEvent("page view", { timestamp: 1700000400 }),
|
|
83
87
|
mapping: {
|
|
84
88
|
data: "data.title"
|
|
@@ -86,6 +90,8 @@ var pageView = {
|
|
|
86
90
|
out: [["_paq.push", ["trackPageView", "walkerOS documentation"]]]
|
|
87
91
|
};
|
|
88
92
|
var customEvent = {
|
|
93
|
+
title: "Custom event with goal",
|
|
94
|
+
description: "A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",
|
|
89
95
|
in: getEvent("promotion visible", { timestamp: 1700000401 }),
|
|
90
96
|
mapping: {
|
|
91
97
|
name: "trackEvent",
|
|
@@ -102,6 +108,8 @@ var customEvent = {
|
|
|
102
108
|
]
|
|
103
109
|
};
|
|
104
110
|
var ecommerceOrder = {
|
|
111
|
+
title: "Ecommerce order",
|
|
112
|
+
description: "A completed order calls Matomo trackEcommerceOrder with line items and order totals.",
|
|
105
113
|
in: getEvent("order complete", { timestamp: 1700000402 }),
|
|
106
114
|
mapping: {
|
|
107
115
|
name: "trackEcommerceOrder",
|
|
@@ -165,6 +173,8 @@ var ecommerceOrder = {
|
|
|
165
173
|
]
|
|
166
174
|
};
|
|
167
175
|
var ecommerceCartUpdate = {
|
|
176
|
+
title: "Cart update",
|
|
177
|
+
description: "A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",
|
|
168
178
|
in: getEvent("cart view", { timestamp: 1700000403 }),
|
|
169
179
|
mapping: {
|
|
170
180
|
name: "trackEcommerceCartUpdate",
|
|
@@ -209,6 +219,8 @@ var ecommerceCartUpdate = {
|
|
|
209
219
|
]
|
|
210
220
|
};
|
|
211
221
|
var productDetailView = {
|
|
222
|
+
title: "Product detail view",
|
|
223
|
+
description: "A product view fires Matomo ecommerceProductDetailView with a single-product array.",
|
|
212
224
|
in: getEvent("product view", { timestamp: 1700000404 }),
|
|
213
225
|
mapping: {
|
|
214
226
|
name: "ecommerceProductDetailView",
|
|
@@ -247,6 +259,8 @@ var productDetailView = {
|
|
|
247
259
|
]
|
|
248
260
|
};
|
|
249
261
|
var siteSearch = {
|
|
262
|
+
title: "Site search",
|
|
263
|
+
description: "A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",
|
|
250
264
|
in: getEvent("search submit", {
|
|
251
265
|
timestamp: 1700000405,
|
|
252
266
|
data: { query: "shoes", category: "products", resultsCount: 42 }
|
|
@@ -263,6 +277,8 @@ var siteSearch = {
|
|
|
263
277
|
out: [["_paq.push", ["trackSiteSearch", "shoes", "products", 42]]]
|
|
264
278
|
};
|
|
265
279
|
var goalTracking = {
|
|
280
|
+
title: "Goal with value",
|
|
281
|
+
description: "A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",
|
|
266
282
|
in: getEvent("promotion visible", {
|
|
267
283
|
timestamp: 1700000406,
|
|
268
284
|
data: { name: "Setting up tracking easily", position: "hero", value: 50 }
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-matomo",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -140,6 +140,8 @@
|
|
|
140
140
|
},
|
|
141
141
|
"step": {
|
|
142
142
|
"customEvent": {
|
|
143
|
+
"title": "Custom event with goal",
|
|
144
|
+
"description": "A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",
|
|
143
145
|
"in": {
|
|
144
146
|
"name": "promotion visible",
|
|
145
147
|
"data": {
|
|
@@ -190,7 +192,7 @@
|
|
|
190
192
|
"group": "gr0up",
|
|
191
193
|
"count": 1,
|
|
192
194
|
"version": {
|
|
193
|
-
"source": "3.4.
|
|
195
|
+
"source": "3.4.1",
|
|
194
196
|
"tagging": 1
|
|
195
197
|
},
|
|
196
198
|
"source": {
|
|
@@ -231,6 +233,8 @@
|
|
|
231
233
|
]
|
|
232
234
|
},
|
|
233
235
|
"ecommerceCartUpdate": {
|
|
236
|
+
"title": "Cart update",
|
|
237
|
+
"description": "A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",
|
|
234
238
|
"in": {
|
|
235
239
|
"name": "cart view",
|
|
236
240
|
"data": {
|
|
@@ -286,7 +290,7 @@
|
|
|
286
290
|
"group": "gr0up",
|
|
287
291
|
"count": 1,
|
|
288
292
|
"version": {
|
|
289
|
-
"source": "3.4.
|
|
293
|
+
"source": "3.4.1",
|
|
290
294
|
"tagging": 1
|
|
291
295
|
},
|
|
292
296
|
"source": {
|
|
@@ -344,6 +348,8 @@
|
|
|
344
348
|
]
|
|
345
349
|
},
|
|
346
350
|
"ecommerceOrder": {
|
|
351
|
+
"title": "Ecommerce order",
|
|
352
|
+
"description": "A completed order calls Matomo trackEcommerceOrder with line items and order totals.",
|
|
347
353
|
"in": {
|
|
348
354
|
"name": "order complete",
|
|
349
355
|
"data": {
|
|
@@ -430,7 +436,7 @@
|
|
|
430
436
|
"group": "gr0up",
|
|
431
437
|
"count": 1,
|
|
432
438
|
"version": {
|
|
433
|
-
"source": "3.4.
|
|
439
|
+
"source": "3.4.1",
|
|
434
440
|
"tagging": 1
|
|
435
441
|
},
|
|
436
442
|
"source": {
|
|
@@ -507,6 +513,8 @@
|
|
|
507
513
|
]
|
|
508
514
|
},
|
|
509
515
|
"goalTracking": {
|
|
516
|
+
"title": "Goal with value",
|
|
517
|
+
"description": "A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",
|
|
510
518
|
"in": {
|
|
511
519
|
"name": "promotion visible",
|
|
512
520
|
"data": {
|
|
@@ -558,7 +566,7 @@
|
|
|
558
566
|
"group": "gr0up",
|
|
559
567
|
"count": 1,
|
|
560
568
|
"version": {
|
|
561
|
-
"source": "3.4.
|
|
569
|
+
"source": "3.4.1",
|
|
562
570
|
"tagging": 1
|
|
563
571
|
},
|
|
564
572
|
"source": {
|
|
@@ -598,6 +606,8 @@
|
|
|
598
606
|
]
|
|
599
607
|
},
|
|
600
608
|
"init": {
|
|
609
|
+
"title": "Initialization",
|
|
610
|
+
"description": "Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",
|
|
601
611
|
"in": {
|
|
602
612
|
"loadScript": true,
|
|
603
613
|
"settings": {
|
|
@@ -629,6 +639,8 @@
|
|
|
629
639
|
]
|
|
630
640
|
},
|
|
631
641
|
"pageView": {
|
|
642
|
+
"title": "Page view",
|
|
643
|
+
"description": "A page view is tracked in Matomo via trackPageView with the page title from event data.",
|
|
632
644
|
"in": {
|
|
633
645
|
"name": "page view",
|
|
634
646
|
"data": {
|
|
@@ -683,7 +695,7 @@
|
|
|
683
695
|
"group": "gr0up",
|
|
684
696
|
"count": 1,
|
|
685
697
|
"version": {
|
|
686
|
-
"source": "3.4.
|
|
698
|
+
"source": "3.4.1",
|
|
687
699
|
"tagging": 1
|
|
688
700
|
},
|
|
689
701
|
"source": {
|
|
@@ -706,6 +718,8 @@
|
|
|
706
718
|
]
|
|
707
719
|
},
|
|
708
720
|
"productDetailView": {
|
|
721
|
+
"title": "Product detail view",
|
|
722
|
+
"description": "A product view fires Matomo ecommerceProductDetailView with a single-product array.",
|
|
709
723
|
"in": {
|
|
710
724
|
"name": "product view",
|
|
711
725
|
"data": {
|
|
@@ -745,7 +759,7 @@
|
|
|
745
759
|
"group": "gr0up",
|
|
746
760
|
"count": 1,
|
|
747
761
|
"version": {
|
|
748
|
-
"source": "3.4.
|
|
762
|
+
"source": "3.4.1",
|
|
749
763
|
"tagging": 1
|
|
750
764
|
},
|
|
751
765
|
"source": {
|
|
@@ -793,6 +807,8 @@
|
|
|
793
807
|
]
|
|
794
808
|
},
|
|
795
809
|
"siteSearch": {
|
|
810
|
+
"title": "Site search",
|
|
811
|
+
"description": "A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",
|
|
796
812
|
"in": {
|
|
797
813
|
"name": "search submit",
|
|
798
814
|
"data": {
|
|
@@ -844,7 +860,7 @@
|
|
|
844
860
|
"group": "gr0up",
|
|
845
861
|
"count": 1,
|
|
846
862
|
"version": {
|
|
847
|
-
"source": "3.4.
|
|
863
|
+
"source": "3.4.1",
|
|
848
864
|
"tagging": 1
|
|
849
865
|
},
|
|
850
866
|
"source": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-matomo",
|
|
3
3
|
"description": "Matomo web destination for walkerOS",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"update": "npx npm-check-updates -u && npm update"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@walkeros/core": "3.4.
|
|
41
|
-
"@walkeros/web-core": "3.4.
|
|
40
|
+
"@walkeros/core": "3.4.1",
|
|
41
|
+
"@walkeros/web-core": "3.4.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@walkeros/collector": "3.4.
|
|
44
|
+
"@walkeros/collector": "3.4.1"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|