@walkeros/web-destination-matomo 4.6.0 → 4.7.0-next-1790187973605

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,35 @@
1
1
  # @walkeros/web-destination-matomo
2
2
 
3
+ ## 4.7.0-next-1790187973605
4
+
5
+ ### Patch Changes
6
+
7
+ - 8b55801: A page view rule with a goal now still tracks the page view, and rule
8
+ `data` replaces the title. Unmapped events and goal IDs that are not positive
9
+ integers are skipped with a warning. Custom dimensions resolve per event
10
+ without leaking into later hits. The `url` gets one trailing slash, and
11
+ `siteId` and `url` are required only with `loadScript`.
12
+ - Updated dependencies [57788bc]
13
+ - Updated dependencies [f5a1cfd]
14
+ - Updated dependencies [ef02916]
15
+ - Updated dependencies [ef02916]
16
+ - Updated dependencies [2aebc53]
17
+ - Updated dependencies [f5a1cfd]
18
+ - Updated dependencies [f5a1cfd]
19
+ - Updated dependencies [2aebc53]
20
+ - Updated dependencies [8f8aea6]
21
+ - Updated dependencies [2aebc53]
22
+ - Updated dependencies [2aebc53]
23
+ - @walkeros/core@4.7.0-next-1790187973605
24
+ - @walkeros/web-core@4.7.0-next-1790187973605
25
+
26
+ ## 4.6.1
27
+
28
+ ### Patch Changes
29
+
30
+ - @walkeros/core@4.6.1
31
+ - @walkeros/web-core@4.6.1
32
+
3
33
  ## 4.6.0
4
34
 
5
35
  ### Patch Changes
package/dist/dev.d.mts CHANGED
@@ -1,25 +1,25 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
+ import { Mapping as Mapping$1, Flow } from '@walkeros/core';
3
4
  import { DestinationWeb } from '@walkeros/web-core';
4
- import { Flow } from '@walkeros/core';
5
5
 
6
6
  declare const SettingsSchema: z.ZodObject<{
7
- siteId: z.ZodString;
8
- url: z.ZodString;
7
+ siteId: z.ZodOptional<z.ZodString>;
8
+ url: z.ZodOptional<z.ZodString>;
9
9
  disableCookies: z.ZodDefault<z.ZodBoolean>;
10
10
  enableLinkTracking: z.ZodDefault<z.ZodBoolean>;
11
11
  enableHeartBeatTimer: z.ZodOptional<z.ZodNumber>;
12
- customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
12
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
13
13
  }, z.core.$strip>;
14
- type Settings = z.infer<typeof SettingsSchema>;
14
+ type Settings$1 = z.infer<typeof SettingsSchema>;
15
15
 
16
16
  declare const MappingSchema: z.ZodObject<{
17
- goalId: z.ZodOptional<z.ZodString>;
18
- goalValue: z.ZodOptional<z.ZodString>;
17
+ goalId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
18
+ goalValue: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
19
19
  siteSearch: z.ZodOptional<z.ZodBoolean>;
20
20
  contentImpression: z.ZodOptional<z.ZodBoolean>;
21
21
  contentInteraction: z.ZodOptional<z.ZodBoolean>;
22
- customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
23
23
  }, z.core.$strip>;
24
24
  type Mapping = z.infer<typeof MappingSchema>;
25
25
 
@@ -28,12 +28,11 @@ declare const mapping: _walkeros_core_dev.JSONSchema;
28
28
 
29
29
  type index$1_Mapping = Mapping;
30
30
  declare const index$1_MappingSchema: typeof MappingSchema;
31
- type index$1_Settings = Settings;
32
31
  declare const index$1_SettingsSchema: typeof SettingsSchema;
33
32
  declare const index$1_mapping: typeof mapping;
34
33
  declare const index$1_settings: typeof settings;
35
34
  declare namespace index$1 {
36
- export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
35
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
37
36
  }
38
37
 
39
38
  declare global {
@@ -41,9 +40,25 @@ declare global {
41
40
  _paq?: Array<unknown>;
42
41
  }
43
42
  }
43
+ /** Bare dimension id (like "1") to a Mapping Value resolved per event. */
44
+ type CustomDimensions = Record<string, Mapping$1.Value>;
45
+ interface Settings {
46
+ /** Matomo Site ID; required when `loadScript` is true. */
47
+ siteId?: string;
48
+ /** Base URL of the Matomo instance, like https://analytics.example.com/; required when `loadScript` is true. */
49
+ url?: string;
50
+ /** Disable all tracking cookies for cookie-free analytics. */
51
+ disableCookies?: boolean;
52
+ /** Enable automatic outlink and download tracking. Default: true. */
53
+ enableLinkTracking?: boolean;
54
+ /** Enable heart beat timer with interval in seconds for accurate time-on-page. */
55
+ enableHeartBeatTimer?: number;
56
+ /** Custom dimensions applied to every hit, keyed by bare dimension id. */
57
+ customDimensions?: CustomDimensions;
58
+ }
44
59
  interface Env extends DestinationWeb.Env {
45
60
  window: {
46
- _paq: Array<unknown>;
61
+ _paq?: Array<unknown>;
47
62
  location?: {
48
63
  href?: string;
49
64
  };
@@ -80,56 +95,78 @@ declare namespace env {
80
95
  export { init$1 as init, env_push as push, env_simulation as simulation };
81
96
  }
82
97
 
98
+ /**
99
+ * Matomo step example. The test runner registers the destination with the
100
+ * init example's config and merges an example's optional `settings` on top.
101
+ */
102
+ type StepExample = Flow.StepExample & {
103
+ /** Destination settings merged over the init example's settings. */
104
+ settings?: Settings;
105
+ };
83
106
  /**
84
107
  * Destination bootstrap.
85
108
  * Given the canonical settings, init loads the Matomo script and configures
86
109
  * the tracker URL, site ID, and link tracking. Reproduce by passing the same
87
110
  * settings to `startFlow` as the destination config.
88
111
  */
89
- declare const init: Flow.StepExample;
112
+ declare const init: StepExample;
90
113
  /**
91
114
  * Default page view -- no mapping name needed.
92
115
  * Destination auto-calls trackPageView with the page title.
93
116
  */
94
- declare const pageView: Flow.StepExample;
117
+ declare const pageView: StepExample;
118
+ /**
119
+ * Page view rule with a goal -- the default trackPageView stays and the goal
120
+ * follows it.
121
+ */
122
+ declare const pageViewWithGoal: StepExample;
95
123
  /**
96
124
  * Custom event tracking with goal conversion.
97
125
  * Uses trackEvent with mapped name, followed by trackGoal.
98
126
  */
99
- declare const customEvent: Flow.StepExample;
127
+ declare const customEvent: StepExample;
100
128
  /**
101
129
  * Ecommerce order -- one call with cart items array and order totals.
102
130
  */
103
- declare const ecommerceOrder: Flow.StepExample;
131
+ declare const ecommerceOrder: StepExample;
104
132
  /**
105
133
  * Ecommerce cart update -- addEcommerceItem per nested product,
106
134
  * then trackEcommerceCartUpdate with cart total.
107
135
  */
108
- declare const ecommerceCartUpdate: Flow.StepExample;
136
+ declare const ecommerceCartUpdate: StepExample;
109
137
  /**
110
138
  * Product detail view -- setEcommerceView equivalent with a single product array.
111
139
  */
112
- declare const productDetailView: Flow.StepExample;
140
+ declare const productDetailView: StepExample;
113
141
  /**
114
142
  * Site search -- trackSiteSearch with keyword, category, result count.
115
143
  */
116
- declare const siteSearch: Flow.StepExample;
144
+ declare const siteSearch: StepExample;
117
145
  /**
118
146
  * Goal tracking alongside a tracked event.
119
147
  * Uses a known fixture event (promotion visible) so data paths resolve.
120
148
  */
121
- declare const goalTracking: Flow.StepExample;
149
+ declare const goalTracking: StepExample;
150
+ /**
151
+ * Destination and rule custom dimensions, resolved per event. The destination
152
+ * dimensions come from `settings`, which the docs do not show, so this
153
+ * example stays out of them.
154
+ */
155
+ declare const customDimensions: StepExample;
122
156
 
157
+ type step_StepExample = StepExample;
158
+ declare const step_customDimensions: typeof customDimensions;
123
159
  declare const step_customEvent: typeof customEvent;
124
160
  declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
125
161
  declare const step_ecommerceOrder: typeof ecommerceOrder;
126
162
  declare const step_goalTracking: typeof goalTracking;
127
163
  declare const step_init: typeof init;
128
164
  declare const step_pageView: typeof pageView;
165
+ declare const step_pageViewWithGoal: typeof pageViewWithGoal;
129
166
  declare const step_productDetailView: typeof productDetailView;
130
167
  declare const step_siteSearch: typeof siteSearch;
131
168
  declare namespace step {
132
- export { step_customEvent as customEvent, step_ecommerceCartUpdate as ecommerceCartUpdate, step_ecommerceOrder as ecommerceOrder, step_goalTracking as goalTracking, step_init as init, step_pageView as pageView, step_productDetailView as productDetailView, step_siteSearch as siteSearch };
169
+ export { type step_StepExample as StepExample, step_customDimensions as customDimensions, step_customEvent as customEvent, step_ecommerceCartUpdate as ecommerceCartUpdate, step_ecommerceOrder as ecommerceOrder, step_goalTracking as goalTracking, step_init as init, step_pageView as pageView, step_pageViewWithGoal as pageViewWithGoal, step_productDetailView as productDetailView, step_siteSearch as siteSearch };
133
170
  }
134
171
 
135
172
  declare const index_env: typeof env;
package/dist/dev.d.ts CHANGED
@@ -1,25 +1,25 @@
1
1
  import * as _walkeros_core_dev from '@walkeros/core/dev';
2
2
  import { z } from '@walkeros/core/dev';
3
+ import { Mapping as Mapping$1, Flow } from '@walkeros/core';
3
4
  import { DestinationWeb } from '@walkeros/web-core';
4
- import { Flow } from '@walkeros/core';
5
5
 
6
6
  declare const SettingsSchema: z.ZodObject<{
7
- siteId: z.ZodString;
8
- url: z.ZodString;
7
+ siteId: z.ZodOptional<z.ZodString>;
8
+ url: z.ZodOptional<z.ZodString>;
9
9
  disableCookies: z.ZodDefault<z.ZodBoolean>;
10
10
  enableLinkTracking: z.ZodDefault<z.ZodBoolean>;
11
11
  enableHeartBeatTimer: z.ZodOptional<z.ZodNumber>;
12
- customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
12
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
13
13
  }, z.core.$strip>;
14
- type Settings = z.infer<typeof SettingsSchema>;
14
+ type Settings$1 = z.infer<typeof SettingsSchema>;
15
15
 
16
16
  declare const MappingSchema: z.ZodObject<{
17
- goalId: z.ZodOptional<z.ZodString>;
18
- goalValue: z.ZodOptional<z.ZodString>;
17
+ goalId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
18
+ goalValue: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
19
19
  siteSearch: z.ZodOptional<z.ZodBoolean>;
20
20
  contentImpression: z.ZodOptional<z.ZodBoolean>;
21
21
  contentInteraction: z.ZodOptional<z.ZodBoolean>;
22
- customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
23
23
  }, z.core.$strip>;
24
24
  type Mapping = z.infer<typeof MappingSchema>;
25
25
 
@@ -28,12 +28,11 @@ declare const mapping: _walkeros_core_dev.JSONSchema;
28
28
 
29
29
  type index$1_Mapping = Mapping;
30
30
  declare const index$1_MappingSchema: typeof MappingSchema;
31
- type index$1_Settings = Settings;
32
31
  declare const index$1_SettingsSchema: typeof SettingsSchema;
33
32
  declare const index$1_mapping: typeof mapping;
34
33
  declare const index$1_settings: typeof settings;
35
34
  declare namespace index$1 {
36
- export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
35
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type Settings$1 as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
37
36
  }
38
37
 
39
38
  declare global {
@@ -41,9 +40,25 @@ declare global {
41
40
  _paq?: Array<unknown>;
42
41
  }
43
42
  }
43
+ /** Bare dimension id (like "1") to a Mapping Value resolved per event. */
44
+ type CustomDimensions = Record<string, Mapping$1.Value>;
45
+ interface Settings {
46
+ /** Matomo Site ID; required when `loadScript` is true. */
47
+ siteId?: string;
48
+ /** Base URL of the Matomo instance, like https://analytics.example.com/; required when `loadScript` is true. */
49
+ url?: string;
50
+ /** Disable all tracking cookies for cookie-free analytics. */
51
+ disableCookies?: boolean;
52
+ /** Enable automatic outlink and download tracking. Default: true. */
53
+ enableLinkTracking?: boolean;
54
+ /** Enable heart beat timer with interval in seconds for accurate time-on-page. */
55
+ enableHeartBeatTimer?: number;
56
+ /** Custom dimensions applied to every hit, keyed by bare dimension id. */
57
+ customDimensions?: CustomDimensions;
58
+ }
44
59
  interface Env extends DestinationWeb.Env {
45
60
  window: {
46
- _paq: Array<unknown>;
61
+ _paq?: Array<unknown>;
47
62
  location?: {
48
63
  href?: string;
49
64
  };
@@ -80,56 +95,78 @@ declare namespace env {
80
95
  export { init$1 as init, env_push as push, env_simulation as simulation };
81
96
  }
82
97
 
98
+ /**
99
+ * Matomo step example. The test runner registers the destination with the
100
+ * init example's config and merges an example's optional `settings` on top.
101
+ */
102
+ type StepExample = Flow.StepExample & {
103
+ /** Destination settings merged over the init example's settings. */
104
+ settings?: Settings;
105
+ };
83
106
  /**
84
107
  * Destination bootstrap.
85
108
  * Given the canonical settings, init loads the Matomo script and configures
86
109
  * the tracker URL, site ID, and link tracking. Reproduce by passing the same
87
110
  * settings to `startFlow` as the destination config.
88
111
  */
89
- declare const init: Flow.StepExample;
112
+ declare const init: StepExample;
90
113
  /**
91
114
  * Default page view -- no mapping name needed.
92
115
  * Destination auto-calls trackPageView with the page title.
93
116
  */
94
- declare const pageView: Flow.StepExample;
117
+ declare const pageView: StepExample;
118
+ /**
119
+ * Page view rule with a goal -- the default trackPageView stays and the goal
120
+ * follows it.
121
+ */
122
+ declare const pageViewWithGoal: StepExample;
95
123
  /**
96
124
  * Custom event tracking with goal conversion.
97
125
  * Uses trackEvent with mapped name, followed by trackGoal.
98
126
  */
99
- declare const customEvent: Flow.StepExample;
127
+ declare const customEvent: StepExample;
100
128
  /**
101
129
  * Ecommerce order -- one call with cart items array and order totals.
102
130
  */
103
- declare const ecommerceOrder: Flow.StepExample;
131
+ declare const ecommerceOrder: StepExample;
104
132
  /**
105
133
  * Ecommerce cart update -- addEcommerceItem per nested product,
106
134
  * then trackEcommerceCartUpdate with cart total.
107
135
  */
108
- declare const ecommerceCartUpdate: Flow.StepExample;
136
+ declare const ecommerceCartUpdate: StepExample;
109
137
  /**
110
138
  * Product detail view -- setEcommerceView equivalent with a single product array.
111
139
  */
112
- declare const productDetailView: Flow.StepExample;
140
+ declare const productDetailView: StepExample;
113
141
  /**
114
142
  * Site search -- trackSiteSearch with keyword, category, result count.
115
143
  */
116
- declare const siteSearch: Flow.StepExample;
144
+ declare const siteSearch: StepExample;
117
145
  /**
118
146
  * Goal tracking alongside a tracked event.
119
147
  * Uses a known fixture event (promotion visible) so data paths resolve.
120
148
  */
121
- declare const goalTracking: Flow.StepExample;
149
+ declare const goalTracking: StepExample;
150
+ /**
151
+ * Destination and rule custom dimensions, resolved per event. The destination
152
+ * dimensions come from `settings`, which the docs do not show, so this
153
+ * example stays out of them.
154
+ */
155
+ declare const customDimensions: StepExample;
122
156
 
157
+ type step_StepExample = StepExample;
158
+ declare const step_customDimensions: typeof customDimensions;
123
159
  declare const step_customEvent: typeof customEvent;
124
160
  declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
125
161
  declare const step_ecommerceOrder: typeof ecommerceOrder;
126
162
  declare const step_goalTracking: typeof goalTracking;
127
163
  declare const step_init: typeof init;
128
164
  declare const step_pageView: typeof pageView;
165
+ declare const step_pageViewWithGoal: typeof pageViewWithGoal;
129
166
  declare const step_productDetailView: typeof productDetailView;
130
167
  declare const step_siteSearch: typeof siteSearch;
131
168
  declare namespace step {
132
- export { step_customEvent as customEvent, step_ecommerceCartUpdate as ecommerceCartUpdate, step_ecommerceOrder as ecommerceOrder, step_goalTracking as goalTracking, step_init as init, step_pageView as pageView, step_productDetailView as productDetailView, step_siteSearch as siteSearch };
169
+ export { type step_StepExample as StepExample, step_customDimensions as customDimensions, step_customEvent as customEvent, step_ecommerceCartUpdate as ecommerceCartUpdate, step_ecommerceOrder as ecommerceOrder, step_goalTracking as goalTracking, step_init as init, step_pageView as pageView, step_pageViewWithGoal as pageViewWithGoal, step_productDetailView as productDetailView, step_siteSearch as siteSearch };
133
170
  }
134
171
 
135
172
  declare const index_env: typeof env;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},n={};o(n,{examples:()=>h,schemas:()=>c}),module.exports=(e=n,((e,o,n,c)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let s of i(o))r.call(e,s)||s===n||t(e,s,{get:()=>o[s],enumerable:!(c=a(o,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c={};o(c,{MappingSchema:()=>m,SettingsSchema:()=>d,mapping:()=>g,settings:()=>u});var s=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),d=p.z.object({siteId:p.z.string().min(1).describe("Matomo Site ID (like 1, 2, etc.)"),url:p.z.string().url().describe("Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)"),disableCookies:p.z.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:p.z.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:p.z.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:p.z.record(p.z.string(),p.z.string()).optional().describe('Custom dimension ID to property path mapping applied to all events (like { "1": "data.userType" })')}),l=require("@walkeros/core/dev"),m=l.z.object({goalId:l.z.string().optional().describe("Goal ID to track a conversion alongside this event (like 1)"),goalValue:l.z.string().optional().describe("Property path for goal revenue value (like data.revenue)"),siteSearch:l.z.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:l.z.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:l.z.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:l.z.record(l.z.string(),l.z.string()).optional().describe('Per-event custom dimension ID to property path mapping (like { "3": "data.category" })')}),u=(0,s.zodToSchema)(d),g=(0,s.zodToSchema)(m),h={};o(h,{env:()=>k,step:()=>b});var k={};o(k,{init:()=>v,push:()=>y,simulation:()=>w});var v={window:{_paq:void 0,location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},y={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},w=["call:window._paq.push"],b={};o(b,{customEvent:()=>S,ecommerceCartUpdate:()=>_,ecommerceOrder:()=>z,goalTracking:()=>O,init:()=>E,pageView:()=>f,productDetailView:()=>I,siteSearch:()=>C});var q=require("@walkeros/core"),E={title:"Initialization",description:"Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",in:{loadScript:!0,settings:{siteId:"1",url:"https://analytics.example.com/"}},out:[["_paq.push",["setTrackerUrl","https://analytics.example.com/matomo.php"]],["_paq.push",["setSiteId","1"]],["_paq.push",["enableLinkTracking"]]]},f={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:(0,q.getEvent)("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},S={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:(0,q.getEvent)("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"goal_1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","goal_1",void 0]]]},z={title:"Ecommerce order",description:"A completed order calls Matomo trackEcommerceOrder with line items and order totals.",in:(0,q.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>(0,q.isObject)(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["_paq.push",["trackEcommerceOrder",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1},{sku:"cc",name:"Cool Cap",category:"",price:42,quantity:1}],{orderId:"0rd3r1d",grandTotal:555,tax:73.76,shipping:5.22}]]]},_={title:"Cart update",description:"A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",in:(0,q.getEvent)("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>(0,q.isObject)(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},"data.value"]}},out:[["_paq.push",["trackEcommerceCartUpdate",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1}],840]]]},I={title:"Product detail view",description:"A product view fires Matomo ecommerceProductDetailView with a single-product array.",in:(0,q.getEvent)("product view",{timestamp:1700000404}),mapping:{name:"ecommerceProductDetailView",data:{set:[{set:[{map:{sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1}}}]}]}},out:[["_paq.push",["ecommerceProductDetailView",[{sku:"ers",name:"Everyday Ruck Snack",price:420,quantity:1}]]]]},C={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:(0,q.getEvent)("search submit",{timestamp:1700000405,data:{query:"shoes",category:"products",resultsCount:42}}),mapping:{name:"trackSiteSearch",settings:{siteSearch:!0},data:{set:["data.query","data.category","data.resultsCount"]}},out:[["_paq.push",["trackSiteSearch","shoes","products",42]]]},O={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:(0,q.getEvent)("promotion visible",{timestamp:1700000406,data:{name:"Setting up tracking easily",position:"hero",value:50}}),mapping:{name:"trackEvent",settings:{goalId:"1",goalValue:"data.value"},data:{set:["data.name"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily"]],["_paq.push",["trackGoal","1",50]]]};//# sourceMappingURL=dev.js.map
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
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n title: 'Ecommerce order',\n description:\n 'A completed order calls Matomo trackEcommerceOrder with line items and order totals.',\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n title: 'Cart update',\n description:\n 'A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n title: 'Product detail view',\n description:\n 'A product view fires Matomo ecommerceProductDetailView with a single-product array.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n title: 'Goal with value',\n description:\n 'A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.',\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,kCAAkC;AAAA,EACrE,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,aACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,aACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,aACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,kBAAkB,aACf,OAAO,aAAE,OAAO,GAAG,aAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;AChCD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,QAAQ,cACL,OAAO,EACP,SAAS,EACT,SAAS,6DAA6D;AAAA,EACzE,WAAW,cACR,OAAO,EACP,SAAS,EACT,SAAS,0DAA0D;AAAA,EACtE,YAAY,cACT,QAAQ,EACR,SAAS,EACT,SAAS,qDAAqD;AAAA,EACjE,mBAAmB,cAChB,QAAQ,EACR,SAAS,EACT,SAAS,0DAA0D;AAAA,EACtE,oBAAoB,cACjB,QAAQ,EACR,SAAS,EACT,SAAS,4DAA4D;AAAA,EACxE,kBAAkB,cACf,OAAO,cAAE,OAAO,GAAG,cAAE,OAAO,CAA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U,QAAQ,OAAO,GAAG;AAAA,EAC1E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;","names":["import_dev","import_dev","init"]}
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,aAC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;AAAA,EAC1E,CAAC;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,MACR,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;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"]}
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:()=>c,SettingsSchema:()=>r,mapping:()=>p,settings:()=>s});import{zodToSchema as i}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=o.object({siteId:o.string().min(1).describe("Matomo Site ID (like 1, 2, etc.)"),url:o.string().url().describe("Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)"),disableCookies:o.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:o.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:o.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:o.record(o.string(),o.string()).optional().describe('Custom dimension ID to property path mapping applied to all events (like { "1": "data.userType" })')});import{z as n}from"@walkeros/core/dev";var c=n.object({goalId:n.string().optional().describe("Goal ID to track a conversion alongside this event (like 1)"),goalValue:n.string().optional().describe("Property path for goal revenue value (like data.revenue)"),siteSearch:n.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:n.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:n.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:n.record(n.string(),n.string()).optional().describe('Per-event custom dimension ID to property path mapping (like { "3": "data.category" })')}),s=i(r),p=i(c),d={};t(d,{env:()=>m,step:()=>k});var m={};t(m,{init:()=>l,push:()=>u,simulation:()=>g});var l={window:{_paq:void 0,location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},u={window:{_paq:[],location:{href:"https://www.example.com/page"}},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},g=["call:window._paq.push"],k={};t(k,{customEvent:()=>b,ecommerceCartUpdate:()=>S,ecommerceOrder:()=>f,goalTracking:()=>I,init:()=>y,pageView:()=>w,productDetailView:()=>q,siteSearch:()=>E});import{getEvent as h,isObject as v}from"@walkeros/core";var y={title:"Initialization",description:"Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",in:{loadScript:!0,settings:{siteId:"1",url:"https://analytics.example.com/"}},out:[["_paq.push",["setTrackerUrl","https://analytics.example.com/matomo.php"]],["_paq.push",["setSiteId","1"]],["_paq.push",["enableLinkTracking"]]]},w={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:h("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},b={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:h("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"goal_1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","goal_1",void 0]]]},f={title:"Ecommerce order",description:"A completed order calls Matomo trackEcommerceOrder with line items and order totals.",in:h("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>v(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["_paq.push",["trackEcommerceOrder",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1},{sku:"cc",name:"Cool Cap",category:"",price:42,quantity:1}],{orderId:"0rd3r1d",grandTotal:555,tax:73.76,shipping:5.22}]]]},S={title:"Cart update",description:"A cart view calls Matomo trackEcommerceCartUpdate with the nested product items and cart total.",in:h("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>v(e)&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},"data.value"]}},out:[["_paq.push",["trackEcommerceCartUpdate",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1}],840]]]},q={title:"Product detail view",description:"A product view fires Matomo ecommerceProductDetailView with a single-product array.",in:h("product view",{timestamp:1700000404}),mapping:{name:"ecommerceProductDetailView",data:{set:[{set:[{map:{sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1}}}]}]}},out:[["_paq.push",["ecommerceProductDetailView",[{sku:"ers",name:"Everyday Ruck Snack",price:420,quantity:1}]]]]},E={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:h("search submit",{timestamp:1700000405,data:{query:"shoes",category:"products",resultsCount:42}}),mapping:{name:"trackSiteSearch",settings:{siteSearch:!0},data:{set:["data.query","data.category","data.resultsCount"]}},out:[["_paq.push",["trackSiteSearch","shoes","products",42]]]},I={title:"Goal with value",description:"A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.",in:h("promotion visible",{timestamp:1700000406,data:{name:"Setting up tracking easily",position:"hero",value:50}}),mapping:{name:"trackEvent",settings:{goalId:"1",goalValue:"data.value"},data:{set:["data.name"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily"]],["_paq.push",["trackGoal","1",50]]]};export{d as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
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