@walkeros/web-destination-matomo 4.7.2 → 4.8.0-next-1791441510508

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @walkeros/web-destination-matomo
2
2
 
3
+ ## 4.8.0-next-1791441510508
4
+
5
+ ### Patch Changes
6
+
7
+ - 5593d7b: The ecommerce step examples are no longer published in the docs, and
8
+ their descriptions say they are test fixtures. Matomo needs an
9
+ `addEcommerceItem` call per product before a cart update, and before an order
10
+ to record its products, and tracks a product view as `setEcommerceView`
11
+ followed by a page view. One rule sends one command.
12
+ - 5593d7b: The ecommerce step examples now test for a product entity without a
13
+ package helper. The published condition, shown in the docs and returned by
14
+ `package_get`, referenced a minified import and threw when copied into a flow;
15
+ it now runs on its own.
16
+ - Updated dependencies [5593d7b]
17
+ - @walkeros/core@4.8.0-next-1791441510508
18
+ - @walkeros/web-core@4.8.0-next-1791441510508
19
+
3
20
  ## 4.7.2
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -32,7 +32,13 @@ npm install @walkeros/web-destination-matomo
32
32
  "destinations": {
33
33
  "matomo": {
34
34
  "package": "@walkeros/web-destination-matomo",
35
- "config": {}
35
+ "config": {
36
+ "loadScript": true,
37
+ "settings": {
38
+ "siteId": "1",
39
+ "url": "https://analytics.example.com/"
40
+ }
41
+ }
36
42
  }
37
43
  }
38
44
  }
package/dist/dev.d.mts CHANGED
@@ -127,15 +127,21 @@ declare const pageViewWithGoal: StepExample;
127
127
  declare const customEvent: StepExample;
128
128
  /**
129
129
  * Ecommerce order -- one call with cart items array and order totals.
130
+ * Not public: Matomo records an order's products only after an
131
+ * addEcommerceItem call per product, which one rule cannot send, so this
132
+ * shows mapping mechanics only.
130
133
  */
131
134
  declare const ecommerceOrder: StepExample;
132
135
  /**
133
- * Ecommerce cart update -- addEcommerceItem per nested product,
134
- * then trackEcommerceCartUpdate with cart total.
136
+ * Ecommerce cart update -- nested products and the cart total in one call.
137
+ * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an
138
+ * addEcommerceItem call per product, which one rule cannot send.
135
139
  */
136
140
  declare const ecommerceCartUpdate: StepExample;
137
141
  /**
138
- * Product detail view -- setEcommerceView equivalent with a single product array.
142
+ * Product detail view with a single product array.
143
+ * Not public: Matomo has no ecommerceProductDetailView; it tracks a product
144
+ * view with setEcommerceView followed by trackPageView, two commands.
139
145
  */
140
146
  declare const productDetailView: StepExample;
141
147
  /**
package/dist/dev.d.ts CHANGED
@@ -127,15 +127,21 @@ declare const pageViewWithGoal: StepExample;
127
127
  declare const customEvent: StepExample;
128
128
  /**
129
129
  * Ecommerce order -- one call with cart items array and order totals.
130
+ * Not public: Matomo records an order's products only after an
131
+ * addEcommerceItem call per product, which one rule cannot send, so this
132
+ * shows mapping mechanics only.
130
133
  */
131
134
  declare const ecommerceOrder: StepExample;
132
135
  /**
133
- * Ecommerce cart update -- addEcommerceItem per nested product,
134
- * then trackEcommerceCartUpdate with cart total.
136
+ * Ecommerce cart update -- nested products and the cart total in one call.
137
+ * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an
138
+ * addEcommerceItem call per product, which one rule cannot send.
135
139
  */
136
140
  declare const ecommerceCartUpdate: StepExample;
137
141
  /**
138
- * Product detail view -- setEcommerceView equivalent with a single product array.
142
+ * Product detail view with a single product array.
143
+ * Not public: Matomo has no ecommerceProductDetailView; it tracks a product
144
+ * view with setEcommerceView followed by trackPageView, two commands.
139
145
  */
140
146
  declare const productDetailView: StepExample;
141
147
  /**
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},n={};r(n,{examples:()=>v,schemas:()=>s}),module.exports=(e=n,((e,r,n,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of i(r))o.call(e,c)||c===n||t(e,c,{get:()=>r[c],enumerable:!(s=a(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};r(s,{MappingSchema:()=>g,SettingsSchema:()=>l,mapping:()=>k,settings:()=>h});var c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),{ValueSchema:d}=p.schemas,m=p.z.record(p.z.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),d),l=p.z.object({siteId:p.z.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:p.z.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),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:m.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()}),u=require("@walkeros/core/dev"),g=u.z.object({goalId:u.z.union([u.z.string().regex(/^[1-9]\d*$/,'Goal IDs are positive integers like "1"'),u.z.number().int().positive()]).optional().describe("Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event"),goalValue:u.schemas.ValueSchema.describe('Goal revenue, resolved from the event (like "data.revenue"), passed as the trackGoal revenue').optional(),siteSearch:u.z.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:u.z.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:u.z.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:m.describe('Custom dimensions for this rule, keyed by bare dimension id (like { "3": "data.category" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.').optional()}),h=(0,c.zodToSchema)(l),k=(0,c.zodToSchema)(g),v={};r(v,{env:()=>w,step:()=>S});var w={};r(w,{init:()=>y,push:()=>b,simulation:()=>q});var y={window:{location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},b={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},q=["call:window._paq.push"],S={};r(S,{customDimensions:()=>M,customEvent:()=>C,ecommerceCartUpdate:()=>I,ecommerceOrder:()=>z,goalTracking:()=>V,init:()=>E,pageView:()=>D,pageViewWithGoal:()=>_,productDetailView:()=>O,siteSearch:()=>P});var f=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"]]]},D={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:(0,f.getEvent)("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},_={title:"Page view with goal",description:"A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.",in:(0,f.getEvent)("page view",{timestamp:1700000407}),mapping:{settings:{goalId:"1"}},out:[["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["trackGoal","1",void 0]]]},C={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:(0,f.getEvent)("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","1",void 0]]]},z={title:"Ecommerce order",description:"A completed order calls Matomo trackEcommerceOrder with line items and order totals.",in:(0,f.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>(0,f.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}]]]},I={title:"Cart update",description:"A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",in:(0,f.getEvent)("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>(0,f.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]]]},O={title:"Product detail view",description:"A product view fires Matomo ecommerceProductDetailView with a single-product array.",in:(0,f.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}]]]]},P={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:(0,f.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]]]},V={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:(0,f.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]]]},M={title:"Custom dimensions",description:"Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.",public:!1,in:(0,f.getEvent)("page view",{timestamp:1700000408}),settings:{customDimensions:{1:"globals.pagegroup"}},mapping:{settings:{customDimensions:{2:"data.id"}}},out:[["_paq.push",["setCustomDimension",1,"docs"]],["_paq.push",["setCustomDimension",2,"/docs/"]],["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["deleteCustomDimension",2]],["_paq.push",["setCustomDimension",1,"docs"]]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},r={};n(r,{examples:()=>v,schemas:()=>s}),module.exports=(e=r,((e,n,r,s)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let c of i(n))o.call(e,c)||c===r||t(e,c,{get:()=>n[c],enumerable:!(s=a(n,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};n(s,{MappingSchema:()=>g,SettingsSchema:()=>m,mapping:()=>k,settings:()=>h});var c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),{ValueSchema:d}=p.schemas,l=p.z.record(p.z.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),d),m=p.z.object({siteId:p.z.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:p.z.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),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:l.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()}),u=require("@walkeros/core/dev"),g=u.z.object({goalId:u.z.union([u.z.string().regex(/^[1-9]\d*$/,'Goal IDs are positive integers like "1"'),u.z.number().int().positive()]).optional().describe("Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event"),goalValue:u.schemas.ValueSchema.describe('Goal revenue, resolved from the event (like "data.revenue"), passed as the trackGoal revenue').optional(),siteSearch:u.z.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:u.z.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:u.z.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:l.describe('Custom dimensions for this rule, keyed by bare dimension id (like { "3": "data.category" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.').optional()}),h=(0,c.zodToSchema)(m),k=(0,c.zodToSchema)(g),v={};n(v,{env:()=>y,step:()=>q});var y={};n(y,{init:()=>w,push:()=>b,simulation:()=>f});var w={window:{location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},b={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},f=["call:window._paq.push"],q={};n(q,{customDimensions:()=>x,customEvent:()=>D,ecommerceCartUpdate:()=>I,ecommerceOrder:()=>z,goalTracking:()=>V,init:()=>E,pageView:()=>_,pageViewWithGoal:()=>C,productDetailView:()=>T,siteSearch:()=>M});var S=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"]]]},_={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:(0,S.getEvent)("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},C={title:"Page view with goal",description:"A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.",in:(0,S.getEvent)("page view",{timestamp:1700000407}),mapping:{settings:{goalId:"1"}},out:[["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["trackGoal","1",void 0]]]},D={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:(0,S.getEvent)("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","1",void 0]]]},z={public:!1,title:"Ecommerce order",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",in:(0,S.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in 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}]]]},I={public:!1,title:"Cart update",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",in:(0,S.getEvent)("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in 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]]]},T={public:!1,title:"Product detail view",description:"Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",in:(0,S.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}]]]]},M={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:(0,S.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]]]},V={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:(0,S.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]]]},x={title:"Custom dimensions",description:"Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.",public:!1,in:(0,S.getEvent)("page view",{timestamp:1700000408}),settings:{customDimensions:{1:"globals.pagegroup"}},mapping:{settings:{customDimensions:{2:"data.id"}}},out:[["_paq.push",["setCustomDimension",1,"docs"]],["_paq.push",["setCustomDimension",2,"/docs/"]],["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["deleteCustomDimension",2]],["_paq.push",["setCustomDimension",1,"docs"]]]};//# 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 { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Matomo Site ID (like 1, 2, etc.). Required when loadScript is true',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true',\n )\n .optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions applied to every hit, keyed by bare dimension id (like { \"1\": \"data.userType\" }). Each value is resolved per event. Rule-level customDimensions win per key.',\n ).optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { schemas, z } from '@walkeros/core/dev';\nimport { CustomDimensionsSchema } from './settings';\n\nexport const MappingSchema = z.object({\n goalId: z\n .union([\n z.string().regex(/^[1-9]\\d*$/, 'Goal IDs are positive integers like \"1\"'),\n z.number().int().positive(),\n ])\n .optional()\n .describe(\n 'Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event',\n ),\n goalValue: schemas.ValueSchema.describe(\n 'Goal revenue, resolved from the event (like \"data.revenue\"), passed as the trackGoal revenue',\n ).optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions for this rule, keyed by bare dimension id (like { \"3\": \"data.category\" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.',\n ).optional(),\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 absent: init() is expected to install the queue.\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: [],\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 type { Settings } from '../types';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\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: 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: 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 * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: 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: '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', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: 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: 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: 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: 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: 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\n/**\n * Destination and rule custom dimensions, resolved per event. The destination\n * dimensions come from `settings`, which the docs do not show, so this\n * example stays out of them.\n */\nexport const customDimensions: StepExample = {\n title: 'Custom dimensions',\n description:\n 'Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.',\n public: false,\n in: getEvent('page view', { timestamp: 1700000408 }),\n settings: {\n customDimensions: { '1': 'globals.pagegroup' },\n },\n mapping: {\n settings: {\n customDimensions: { '2': 'data.id' },\n },\n },\n out: [\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ['_paq.push', ['setCustomDimension', 2, '/docs/']],\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['deleteCustomDimension', 2]],\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAA2B;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,aAAE;AAAA,EACtC,aAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,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,S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;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;AAOO,IAAM,mBAAgC;AAAA,EAC3C,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAQ;AAAA,EACR,QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,UAAU;AAAA,IACR,kBAAkB,EAAE,KAAK,oBAAoB;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,kBAAkB,EAAE,KAAK,UAAU;AAAA,IACrC;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,IAC/C,CAAC,aAAa,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AAAA,IACjD,CAAC,aAAa,CAAC,iBAAiB,wBAAwB,CAAC;AAAA,IACzD,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAAA,IAC1C,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,EACjD;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 { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Matomo Site ID (like 1, 2, etc.). Required when loadScript is true',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true',\n )\n .optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions applied to every hit, keyed by bare dimension id (like { \"1\": \"data.userType\" }). Each value is resolved per event. Rule-level customDimensions win per key.',\n ).optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { schemas, z } from '@walkeros/core/dev';\nimport { CustomDimensionsSchema } from './settings';\n\nexport const MappingSchema = z.object({\n goalId: z\n .union([\n z.string().regex(/^[1-9]\\d*$/, 'Goal IDs are positive integers like \"1\"'),\n z.number().int().positive(),\n ])\n .optional()\n .describe(\n 'Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event',\n ),\n goalValue: schemas.ValueSchema.describe(\n 'Goal revenue, resolved from the event (like \"data.revenue\"), passed as the trackGoal revenue',\n ).optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions for this rule, keyed by bare dimension id (like { \"3\": \"data.category\" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.',\n ).optional(),\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 absent: init() is expected to install the queue.\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: [],\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 type { Settings } from '../types';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\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: 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: 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 * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: 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: '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', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n * Not public: Matomo records an order's products only after an\n * addEcommerceItem call per product, which one rule cannot send, so this\n * shows mapping mechanics only.\n */\nexport const ecommerceOrder: StepExample = {\n public: false,\n title: 'Ecommerce order',\n description:\n \"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.\",\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 typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n 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 -- nested products and the cart total in one call.\n * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an\n * addEcommerceItem call per product, which one rule cannot send.\n */\nexport const ecommerceCartUpdate: StepExample = {\n public: false,\n title: 'Cart update',\n description:\n 'Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.',\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 typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n 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 with a single product array.\n * Not public: Matomo has no ecommerceProductDetailView; it tracks a product\n * view with setEcommerceView followed by trackPageView, two commands.\n */\nexport const productDetailView: StepExample = {\n public: false,\n title: 'Product detail view',\n description:\n 'Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.',\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: 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: 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\n/**\n * Destination and rule custom dimensions, resolved per event. The destination\n * dimensions come from `settings`, which the docs do not show, so this\n * example stays out of them.\n */\nexport const customDimensions: StepExample = {\n title: 'Custom dimensions',\n description:\n 'Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.',\n public: false,\n in: getEvent('page view', { timestamp: 1700000408 }),\n settings: {\n customDimensions: { '1': 'globals.pagegroup' },\n },\n mapping: {\n settings: {\n customDimensions: { '2': 'data.id' },\n },\n },\n out: [\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ['_paq.push', ['setCustomDimension', 2, '/docs/']],\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['deleteCustomDimension', 2]],\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAA2B;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,aAAE;AAAA,EACtC,aAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,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,uBAAuB;AAAA,IACvC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;;;AC3CD,IAAAC,cAA2B;AAGpB,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,QAAQ,cACL,MAAM;AAAA,IACL,cAAE,OAAO,EAAE,MAAM,cAAc,yCAAyC;AAAA,IACxE,cAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAC5B,C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;AAAA,IACR,kBAAkB,EAAE,KAAK,oBAAoB;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,kBAAkB,EAAE,KAAK,UAAU;AAAA,IACrC;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,IAC/C,CAAC,aAAa,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AAAA,IACjD,CAAC,aAAa,CAAC,iBAAiB,wBAAwB,CAAC;AAAA,IACzD,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAAA,IAC1C,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,EACjD;AACF;","names":["import_dev","import_dev","init"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
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:()=>m,SettingsSchema:()=>c,mapping:()=>u,settings:()=>l});import{zodToSchema as i}from"@walkeros/core/dev";import{schemas as o,z as r}from"@walkeros/core/dev";var{ValueSchema:n}=o,s=r.record(r.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),n),c=r.object({siteId:r.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:r.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),disableCookies:r.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:r.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:r.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:s.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()});import{schemas as p,z as d}from"@walkeros/core/dev";var m=d.object({goalId:d.union([d.string().regex(/^[1-9]\d*$/,'Goal IDs are positive integers like "1"'),d.number().int().positive()]).optional().describe("Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event"),goalValue:p.ValueSchema.describe('Goal revenue, resolved from the event (like "data.revenue"), passed as the trackGoal revenue').optional(),siteSearch:d.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:d.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:d.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:s.describe('Custom dimensions for this rule, keyed by bare dimension id (like { "3": "data.category" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.').optional()}),l=i(c),u=i(m),g={};t(g,{env:()=>h,step:()=>y});var h={};t(h,{init:()=>k,push:()=>v,simulation:()=>w});var k={window:{location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},v={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},w=["call:window._paq.push"],y={};t(y,{customDimensions:()=>G,customEvent:()=>D,ecommerceCartUpdate:()=>_,ecommerceOrder:()=>E,goalTracking:()=>x,init:()=>S,pageView:()=>f,pageViewWithGoal:()=>C,productDetailView:()=>I,siteSearch:()=>V});import{getEvent as b,isObject as q}from"@walkeros/core";var S={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:b("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},C={title:"Page view with goal",description:"A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.",in:b("page view",{timestamp:1700000407}),mapping:{settings:{goalId:"1"}},out:[["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["trackGoal","1",void 0]]]},D={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:b("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","1",void 0]]]},E={title:"Ecommerce order",description:"A completed order calls Matomo trackEcommerceOrder with line items and order totals.",in:b("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>q(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:b("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>q(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:b("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}]]]]},V={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:b("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]]]},x={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:b("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]]]},G={title:"Custom dimensions",description:"Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.",public:!1,in:b("page view",{timestamp:1700000408}),settings:{customDimensions:{1:"globals.pagegroup"}},mapping:{settings:{customDimensions:{2:"data.id"}}},out:[["_paq.push",["setCustomDimension",1,"docs"]],["_paq.push",["setCustomDimension",2,"/docs/"]],["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["deleteCustomDimension",2]],["_paq.push",["setCustomDimension",1,"docs"]]]};export{g as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
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:()=>m,SettingsSchema:()=>c,mapping:()=>u,settings:()=>l});import{zodToSchema as i}from"@walkeros/core/dev";import{schemas as o,z as n}from"@walkeros/core/dev";var{ValueSchema:r}=o,s=n.record(n.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),r),c=n.object({siteId:n.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:n.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),disableCookies:n.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:n.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:n.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:s.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()});import{schemas as p,z as d}from"@walkeros/core/dev";var m=d.object({goalId:d.union([d.string().regex(/^[1-9]\d*$/,'Goal IDs are positive integers like "1"'),d.number().int().positive()]).optional().describe("Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event"),goalValue:p.ValueSchema.describe('Goal revenue, resolved from the event (like "data.revenue"), passed as the trackGoal revenue').optional(),siteSearch:d.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:d.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:d.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:s.describe('Custom dimensions for this rule, keyed by bare dimension id (like { "3": "data.category" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.').optional()}),l=i(c),u=i(m),g={};t(g,{env:()=>h,step:()=>y});var h={};t(h,{init:()=>k,push:()=>v,simulation:()=>w});var k={window:{location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},v={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},w=["call:window._paq.push"],y={};t(y,{customDimensions:()=>x,customEvent:()=>E,ecommerceCartUpdate:()=>D,ecommerceOrder:()=>C,goalTracking:()=>V,init:()=>f,pageView:()=>q,pageViewWithGoal:()=>S,productDetailView:()=>_,siteSearch:()=>I});import{getEvent as b}from"@walkeros/core";var f={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"]]]},q={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:b("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},S={title:"Page view with goal",description:"A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.",in:b("page view",{timestamp:1700000407}),mapping:{settings:{goalId:"1"}},out:[["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["trackGoal","1",void 0]]]},E={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:b("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","1",void 0]]]},C={public:!1,title:"Ecommerce order",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",in:b("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in 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}]]]},D={public:!1,title:"Cart update",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",in:b("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in 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]]]},_={public:!1,title:"Product detail view",description:"Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",in:b("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}]]]]},I={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:b("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]]]},V={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:b("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]]]},x={title:"Custom dimensions",description:"Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.",public:!1,in:b("page view",{timestamp:1700000408}),settings:{customDimensions:{1:"globals.pagegroup"}},mapping:{settings:{customDimensions:{2:"data.id"}}},out:[["_paq.push",["setCustomDimension",1,"docs"]],["_paq.push",["setCustomDimension",2,"/docs/"]],["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["deleteCustomDimension",2]],["_paq.push",["setCustomDimension",1,"docs"]]]};export{g 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 { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Matomo Site ID (like 1, 2, etc.). Required when loadScript is true',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true',\n )\n .optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions applied to every hit, keyed by bare dimension id (like { \"1\": \"data.userType\" }). Each value is resolved per event. Rule-level customDimensions win per key.',\n ).optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { schemas, z } from '@walkeros/core/dev';\nimport { CustomDimensionsSchema } from './settings';\n\nexport const MappingSchema = z.object({\n goalId: z\n .union([\n z.string().regex(/^[1-9]\\d*$/, 'Goal IDs are positive integers like \"1\"'),\n z.number().int().positive(),\n ])\n .optional()\n .describe(\n 'Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event',\n ),\n goalValue: schemas.ValueSchema.describe(\n 'Goal revenue, resolved from the event (like \"data.revenue\"), passed as the trackGoal revenue',\n ).optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions for this rule, keyed by bare dimension id (like { \"3\": \"data.category\" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.',\n ).optional(),\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 absent: init() is expected to install the queue.\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: [],\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 type { Settings } from '../types';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\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: 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: 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 * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: 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: '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', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: 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: 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: 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: 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: 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\n/**\n * Destination and rule custom dimensions, resolved per event. The destination\n * dimensions come from `settings`, which the docs do not show, so this\n * example stays out of them.\n */\nexport const customDimensions: StepExample = {\n title: 'Custom dimensions',\n description:\n 'Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.',\n public: false,\n in: getEvent('page view', { timestamp: 1700000408 }),\n settings: {\n customDimensions: { '1': 'globals.pagegroup' },\n },\n mapping: {\n settings: {\n customDimensions: { '2': 'data.id' },\n },\n },\n out: [\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ['_paq.push', ['setCustomDimension', 2, '/docs/']],\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['deleteCustomDimension', 2]],\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS,SAAS;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,EAAE;AAAA,EACtC,EAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,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,uBAAuB;AAAA,IACvC;AAAA,EACF,EAAE,SAAS;AACb,CAAC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C;AAAA,EAC3C,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAQ;AAAA,EACR,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,UAAU;AAAA,IACR,kBAAkB,EAAE,KAAK,oBAAoB;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,kBAAkB,EAAE,KAAK,UAAU;AAAA,IACrC;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,IAC/C,CAAC,aAAa,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AAAA,IACjD,CAAC,aAAa,CAAC,iBAAiB,wBAAwB,CAAC;AAAA,IACzD,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAAA,IAC1C,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,EACjD;AACF;","names":["schemas","z","z","schemas","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 { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Matomo Site ID (like 1, 2, etc.). Required when loadScript is true',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true',\n )\n .optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions applied to every hit, keyed by bare dimension id (like { \"1\": \"data.userType\" }). Each value is resolved per event. Rule-level customDimensions win per key.',\n ).optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { schemas, z } from '@walkeros/core/dev';\nimport { CustomDimensionsSchema } from './settings';\n\nexport const MappingSchema = z.object({\n goalId: z\n .union([\n z.string().regex(/^[1-9]\\d*$/, 'Goal IDs are positive integers like \"1\"'),\n z.number().int().positive(),\n ])\n .optional()\n .describe(\n 'Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event',\n ),\n goalValue: schemas.ValueSchema.describe(\n 'Goal revenue, resolved from the event (like \"data.revenue\"), passed as the trackGoal revenue',\n ).optional(),\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: CustomDimensionsSchema.describe(\n 'Custom dimensions for this rule, keyed by bare dimension id (like { \"3\": \"data.category\" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.',\n ).optional(),\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 absent: init() is expected to install the queue.\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: [],\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 type { Settings } from '../types';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\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: 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: 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 * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: 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: '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', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n * Not public: Matomo records an order's products only after an\n * addEcommerceItem call per product, which one rule cannot send, so this\n * shows mapping mechanics only.\n */\nexport const ecommerceOrder: StepExample = {\n public: false,\n title: 'Ecommerce order',\n description:\n \"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.\",\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 typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n 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 -- nested products and the cart total in one call.\n * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an\n * addEcommerceItem call per product, which one rule cannot send.\n */\nexport const ecommerceCartUpdate: StepExample = {\n public: false,\n title: 'Cart update',\n description:\n 'Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.',\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 typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n 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 with a single product array.\n * Not public: Matomo has no ecommerceProductDetailView; it tracks a product\n * view with setEcommerceView followed by trackPageView, two commands.\n */\nexport const productDetailView: StepExample = {\n public: false,\n title: 'Product detail view',\n description:\n 'Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.',\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: 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: 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\n/**\n * Destination and rule custom dimensions, resolved per event. The destination\n * dimensions come from `settings`, which the docs do not show, so this\n * example stays out of them.\n */\nexport const customDimensions: StepExample = {\n title: 'Custom dimensions',\n description:\n 'Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.',\n public: false,\n in: getEvent('page view', { timestamp: 1700000408 }),\n settings: {\n customDimensions: { '1': 'globals.pagegroup' },\n },\n mapping: {\n settings: {\n customDimensions: { '2': 'data.id' },\n },\n },\n out: [\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ['_paq.push', ['setCustomDimension', 2, '/docs/']],\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['deleteCustomDimension', 2]],\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS,SAAS;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,EAAE;AAAA,EACtC,EAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,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,uBAAuB;AAAA,IACvC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;;;AC3CD,SAAS,WAAAA,UAAS,KAAAC,UAAS;AAGpB,IAAM,gBAAgBC,GAAE,OAAO;AAAA,EACpC,QAAQA,GACL,MAAM;AAAA,IACLA,GAAE,OAAO,EAAE,MAAM,cAAc,yCAAyC;AAAA,IACxEA,GAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAC5B,CAAC,EACA,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAWC,SAAQ,YAAY;AAAA,IAC7B;AAAA,EACF,EAAE,SAAS;AAAA,EACX,YAAYD,GACT,QAAQ,EACR,SAAS,EACT,SA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AK;AAAA,IACH,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,IAC/C,CAAC,aAAa,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AAAA,IACjD,CAAC,aAAa,CAAC,iBAAiB,wBAAwB,CAAC;AAAA,IACzD,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAAA,IAC1C,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,EACjD;AACF;","names":["schemas","z","z","schemas","init"]}
@@ -93,15 +93,21 @@ declare const pageViewWithGoal: StepExample;
93
93
  declare const customEvent: StepExample;
94
94
  /**
95
95
  * Ecommerce order -- one call with cart items array and order totals.
96
+ * Not public: Matomo records an order's products only after an
97
+ * addEcommerceItem call per product, which one rule cannot send, so this
98
+ * shows mapping mechanics only.
96
99
  */
97
100
  declare const ecommerceOrder: StepExample;
98
101
  /**
99
- * Ecommerce cart update -- addEcommerceItem per nested product,
100
- * then trackEcommerceCartUpdate with cart total.
102
+ * Ecommerce cart update -- nested products and the cart total in one call.
103
+ * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an
104
+ * addEcommerceItem call per product, which one rule cannot send.
101
105
  */
102
106
  declare const ecommerceCartUpdate: StepExample;
103
107
  /**
104
- * Product detail view -- setEcommerceView equivalent with a single product array.
108
+ * Product detail view with a single product array.
109
+ * Not public: Matomo has no ecommerceProductDetailView; it tracks a product
110
+ * view with setEcommerceView followed by trackPageView, two commands.
105
111
  */
106
112
  declare const productDetailView: StepExample;
107
113
  /**
@@ -93,15 +93,21 @@ declare const pageViewWithGoal: StepExample;
93
93
  declare const customEvent: StepExample;
94
94
  /**
95
95
  * Ecommerce order -- one call with cart items array and order totals.
96
+ * Not public: Matomo records an order's products only after an
97
+ * addEcommerceItem call per product, which one rule cannot send, so this
98
+ * shows mapping mechanics only.
96
99
  */
97
100
  declare const ecommerceOrder: StepExample;
98
101
  /**
99
- * Ecommerce cart update -- addEcommerceItem per nested product,
100
- * then trackEcommerceCartUpdate with cart total.
102
+ * Ecommerce cart update -- nested products and the cart total in one call.
103
+ * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an
104
+ * addEcommerceItem call per product, which one rule cannot send.
101
105
  */
102
106
  declare const ecommerceCartUpdate: StepExample;
103
107
  /**
104
- * Product detail view -- setEcommerceView equivalent with a single product array.
108
+ * Product detail view with a single product array.
109
+ * Not public: Matomo has no ecommerceProductDetailView; it tracks a product
110
+ * view with setEcommerceView followed by trackPageView, two commands.
105
111
  */
106
112
  declare const productDetailView: StepExample;
107
113
  /**
@@ -145,8 +145,9 @@ var customEvent = {
145
145
  ]
146
146
  };
147
147
  var ecommerceOrder = {
148
+ public: false,
148
149
  title: "Ecommerce order",
149
- description: "A completed order calls Matomo trackEcommerceOrder with line items and order totals.",
150
+ description: "Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",
150
151
  in: (0, import_core.getEvent)("order complete", { timestamp: 1700000402 }),
151
152
  mapping: {
152
153
  name: "trackEcommerceOrder",
@@ -156,7 +157,7 @@ var ecommerceOrder = {
156
157
  loop: [
157
158
  "nested",
158
159
  {
159
- condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
160
+ condition: (entity) => typeof entity === "object" && entity !== null && "entity" in entity && entity.entity === "product",
160
161
  map: {
161
162
  sku: "data.id",
162
163
  name: "data.name",
@@ -210,8 +211,9 @@ var ecommerceOrder = {
210
211
  ]
211
212
  };
212
213
  var ecommerceCartUpdate = {
214
+ public: false,
213
215
  title: "Cart update",
214
- description: "A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",
216
+ description: "Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",
215
217
  in: (0, import_core.getEvent)("cart view", { timestamp: 1700000403 }),
216
218
  mapping: {
217
219
  name: "trackEcommerceCartUpdate",
@@ -221,7 +223,7 @@ var ecommerceCartUpdate = {
221
223
  loop: [
222
224
  "nested",
223
225
  {
224
- condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
226
+ condition: (entity) => typeof entity === "object" && entity !== null && "entity" in entity && entity.entity === "product",
225
227
  map: {
226
228
  sku: "data.id",
227
229
  name: "data.name",
@@ -256,8 +258,9 @@ var ecommerceCartUpdate = {
256
258
  ]
257
259
  };
258
260
  var productDetailView = {
261
+ public: false,
259
262
  title: "Product detail view",
260
- description: "A product view fires Matomo ecommerceProductDetailView with a single-product array.",
263
+ description: "Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",
261
264
  in: (0, import_core.getEvent)("product view", { timestamp: 1700000404 }),
262
265
  mapping: {
263
266
  name: "ecommerceProductDetailView",
@@ -62,7 +62,7 @@ __export(step_exports, {
62
62
  productDetailView: () => productDetailView,
63
63
  siteSearch: () => siteSearch
64
64
  });
65
- import { getEvent, isObject } from "@walkeros/core";
65
+ import { getEvent } from "@walkeros/core";
66
66
  var init2 = {
67
67
  title: "Initialization",
68
68
  description: "Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",
@@ -124,8 +124,9 @@ var customEvent = {
124
124
  ]
125
125
  };
126
126
  var ecommerceOrder = {
127
+ public: false,
127
128
  title: "Ecommerce order",
128
- description: "A completed order calls Matomo trackEcommerceOrder with line items and order totals.",
129
+ description: "Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",
129
130
  in: getEvent("order complete", { timestamp: 1700000402 }),
130
131
  mapping: {
131
132
  name: "trackEcommerceOrder",
@@ -135,7 +136,7 @@ var ecommerceOrder = {
135
136
  loop: [
136
137
  "nested",
137
138
  {
138
- condition: (entity) => isObject(entity) && entity.entity === "product",
139
+ condition: (entity) => typeof entity === "object" && entity !== null && "entity" in entity && entity.entity === "product",
139
140
  map: {
140
141
  sku: "data.id",
141
142
  name: "data.name",
@@ -189,8 +190,9 @@ var ecommerceOrder = {
189
190
  ]
190
191
  };
191
192
  var ecommerceCartUpdate = {
193
+ public: false,
192
194
  title: "Cart update",
193
- description: "A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",
195
+ description: "Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",
194
196
  in: getEvent("cart view", { timestamp: 1700000403 }),
195
197
  mapping: {
196
198
  name: "trackEcommerceCartUpdate",
@@ -200,7 +202,7 @@ var ecommerceCartUpdate = {
200
202
  loop: [
201
203
  "nested",
202
204
  {
203
- condition: (entity) => isObject(entity) && entity.entity === "product",
205
+ condition: (entity) => typeof entity === "object" && entity !== null && "entity" in entity && entity.entity === "product",
204
206
  map: {
205
207
  sku: "data.id",
206
208
  name: "data.name",
@@ -235,8 +237,9 @@ var ecommerceCartUpdate = {
235
237
  ]
236
238
  };
237
239
  var productDetailView = {
240
+ public: false,
238
241
  title: "Product detail view",
239
- description: "A product view fires Matomo ecommerceProductDetailView with a single-product array.",
242
+ description: "Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",
240
243
  in: getEvent("product view", { timestamp: 1700000404 }),
241
244
  mapping: {
242
245
  name: "ecommerceProductDetailView",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-matomo",
4
- "version": "4.7.2",
4
+ "version": "4.8.0-next-1791441510508",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -505,7 +505,7 @@
505
505
  "consent": {
506
506
  "functional": true
507
507
  },
508
- "id": "7a4349b3f95f68f5",
508
+ "id": "94575fd559d320b0",
509
509
  "trigger": "load",
510
510
  "entity": "page",
511
511
  "action": "view",
@@ -608,7 +608,7 @@
608
608
  "consent": {
609
609
  "functional": true
610
610
  },
611
- "id": "668fa4b2b68ba1f0",
611
+ "id": "46b5e3e256ba7a54",
612
612
  "trigger": "visible",
613
613
  "entity": "promotion",
614
614
  "action": "visible",
@@ -653,8 +653,9 @@
653
653
  ]
654
654
  },
655
655
  "ecommerceCartUpdate": {
656
+ "public": false,
656
657
  "title": "Cart update",
657
- "description": "A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",
658
+ "description": "Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",
658
659
  "in": {
659
660
  "name": "cart view",
660
661
  "data": {
@@ -701,7 +702,7 @@
701
702
  "consent": {
702
703
  "functional": true
703
704
  },
704
- "id": "524b3c3e4a17e030",
705
+ "id": "22fedc6f4ce95d40",
705
706
  "trigger": "load",
706
707
  "entity": "cart",
707
708
  "action": "view",
@@ -723,7 +724,7 @@
723
724
  "nested",
724
725
  {
725
726
  "condition": {
726
- "$code": "e=>q(e)&&\"product\"===e.entity"
727
+ "$code": "e=>\"object\"==typeof e&&null!==e&&\"entity\"in e&&\"product\"===e.entity"
727
728
  },
728
729
  "map": {
729
730
  "sku": "data.id",
@@ -763,8 +764,9 @@
763
764
  ]
764
765
  },
765
766
  "ecommerceOrder": {
767
+ "public": false,
766
768
  "title": "Ecommerce order",
767
- "description": "A completed order calls Matomo trackEcommerceOrder with line items and order totals.",
769
+ "description": "Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",
768
770
  "in": {
769
771
  "name": "order complete",
770
772
  "data": {
@@ -842,7 +844,7 @@
842
844
  "consent": {
843
845
  "functional": true
844
846
  },
845
- "id": "9a1513236db9b3f9",
847
+ "id": "2f43be8f2ff02e46",
846
848
  "trigger": "load",
847
849
  "entity": "order",
848
850
  "action": "complete",
@@ -864,7 +866,7 @@
864
866
  "nested",
865
867
  {
866
868
  "condition": {
867
- "$code": "e=>q(e)&&\"product\"===e.entity"
869
+ "$code": "e=>\"object\"==typeof e&&null!==e&&\"entity\"in e&&\"product\"===e.entity"
868
870
  },
869
871
  "map": {
870
872
  "sku": "data.id",
@@ -960,7 +962,7 @@
960
962
  "consent": {
961
963
  "functional": true
962
964
  },
963
- "id": "e199612be29e650b",
965
+ "id": "0fc83d09ba2ed0cd",
964
966
  "trigger": "visible",
965
967
  "entity": "promotion",
966
968
  "action": "visible",
@@ -1077,7 +1079,7 @@
1077
1079
  "consent": {
1078
1080
  "functional": true
1079
1081
  },
1080
- "id": "470ec9668a6eb173",
1082
+ "id": "ec37329de0634822",
1081
1083
  "trigger": "load",
1082
1084
  "entity": "page",
1083
1085
  "action": "view",
@@ -1144,7 +1146,7 @@
1144
1146
  "consent": {
1145
1147
  "functional": true
1146
1148
  },
1147
- "id": "a2755b4b53383b31",
1149
+ "id": "17612bd512e5eec9",
1148
1150
  "trigger": "load",
1149
1151
  "entity": "page",
1150
1152
  "action": "view",
@@ -1181,8 +1183,9 @@
1181
1183
  ]
1182
1184
  },
1183
1185
  "productDetailView": {
1186
+ "public": false,
1184
1187
  "title": "Product detail view",
1185
- "description": "A product view fires Matomo ecommerceProductDetailView with a single-product array.",
1188
+ "description": "Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",
1186
1189
  "in": {
1187
1190
  "name": "product view",
1188
1191
  "data": {
@@ -1213,7 +1216,7 @@
1213
1216
  "consent": {
1214
1217
  "functional": true
1215
1218
  },
1216
- "id": "438f500006f29924",
1219
+ "id": "156be12ec7a70312",
1217
1220
  "trigger": "load",
1218
1221
  "entity": "product",
1219
1222
  "action": "view",
@@ -1302,7 +1305,7 @@
1302
1305
  "consent": {
1303
1306
  "functional": true
1304
1307
  },
1305
- "id": "eaf3946c76e82555",
1308
+ "id": "1f9bc32bcfe728ef",
1306
1309
  "trigger": "test",
1307
1310
  "entity": "search",
1308
1311
  "action": "submit",
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": "4.7.2",
4
+ "version": "4.8.0-next-1791441510508",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -38,11 +38,11 @@
38
38
  "update": "npx npm-check-updates -u && npm update"
39
39
  },
40
40
  "dependencies": {
41
- "@walkeros/core": "4.7.2",
42
- "@walkeros/web-core": "4.7.2"
41
+ "@walkeros/core": "4.8.0-next-1791441510508",
42
+ "@walkeros/web-core": "4.8.0-next-1791441510508"
43
43
  },
44
44
  "devDependencies": {
45
- "@walkeros/collector": "4.7.2"
45
+ "@walkeros/collector": "4.8.0-next-1791441510508"
46
46
  },
47
47
  "repository": {
48
48
  "url": "git+https://github.com/elbwalker/walkerOS.git",