@walkeros/web-destination-matomo 3.4.0-next-1776749829492

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/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @walkeros/web-destination-matomo
2
+
3
+ Matomo web destination for [walkerOS](https://github.com/elbwalker/walkerOS).
4
+ Forwards browser events to a self-hosted or cloud Matomo instance via the
5
+ `_paq.push()` command queue with support for page views, custom events,
6
+ ecommerce, goals, site search, content tracking, and custom dimensions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @walkeros/web-destination-matomo
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```json
17
+ {
18
+ "destinations": {
19
+ "matomo": {
20
+ "package": "@walkeros/web-destination-matomo",
21
+ "config": {
22
+ "loadScript": true,
23
+ "settings": {
24
+ "siteId": "1",
25
+ "url": "https://analytics.example.com/"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## Settings
34
+
35
+ | Setting | Type | Required | Default | Description |
36
+ | ---------------------- | ------- | -------- | ------- | --------------------------------------------------- |
37
+ | `siteId` | string | Yes | -- | Matomo Site ID |
38
+ | `url` | string | Yes | -- | Base URL of your Matomo instance |
39
+ | `disableCookies` | boolean | No | `false` | Disable tracking cookies for cookie-free analytics |
40
+ | `enableLinkTracking` | boolean | No | `true` | Auto-track outlinks and downloads |
41
+ | `enableHeartBeatTimer` | number | No | -- | Heart beat timer interval in seconds |
42
+ | `customDimensions` | Record | No | -- | Visit-scope custom dimensions (ID to property path) |
43
+
44
+ ## Mapping Settings
45
+
46
+ Per-event mapping settings control specialized tracking methods:
47
+
48
+ | Setting | Type | Effect |
49
+ | -------------------- | ------- | --------------------------------------------- |
50
+ | `goalId` | string | Fire `trackGoal` alongside the event |
51
+ | `goalValue` | string | Property path for goal revenue value |
52
+ | `siteSearch` | boolean | Use `trackSiteSearch` instead of `trackEvent` |
53
+ | `contentImpression` | boolean | Use `trackContentImpression` |
54
+ | `contentInteraction` | boolean | Use `trackContentInteraction` |
55
+ | `customDimensions` | Record | Action-scope custom dimensions per event |
56
+
57
+ ## Event Mapping
58
+
59
+ | walkerOS Event | Matomo Method | Notes |
60
+ | ---------------- | ---------------------------- | --------------------------------------------------- |
61
+ | `page view` | `trackPageView` | Default, no mapping needed |
62
+ | Any event | `trackEvent` | Default for non-page-view events via `mapping.name` |
63
+ | `order complete` | `trackEcommerceOrder` | Via `mapping.name` |
64
+ | `cart *` | `trackEcommerceCartUpdate` | Via `mapping.name` |
65
+ | `product view` | `ecommerceProductDetailView` | Via `mapping.name` |
66
+ | `search *` | `trackSiteSearch` | Via `mapping.settings.siteSearch` |
package/dist/dev.d.mts ADDED
@@ -0,0 +1,141 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { DestinationWeb } from '@walkeros/web-core';
4
+ import { Flow } from '@walkeros/core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ siteId: z.ZodString;
8
+ url: z.ZodString;
9
+ disableCookies: z.ZodDefault<z.ZodBoolean>;
10
+ enableLinkTracking: z.ZodDefault<z.ZodBoolean>;
11
+ enableHeartBeatTimer: z.ZodOptional<z.ZodNumber>;
12
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
+ }, z.core.$strip>;
14
+ type Settings = z.infer<typeof SettingsSchema>;
15
+
16
+ declare const MappingSchema: z.ZodObject<{
17
+ goalId: z.ZodOptional<z.ZodString>;
18
+ goalValue: z.ZodOptional<z.ZodString>;
19
+ siteSearch: z.ZodOptional<z.ZodBoolean>;
20
+ contentImpression: z.ZodOptional<z.ZodBoolean>;
21
+ contentInteraction: z.ZodOptional<z.ZodBoolean>;
22
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
23
+ }, z.core.$strip>;
24
+ type Mapping = z.infer<typeof MappingSchema>;
25
+
26
+ declare const settings: _walkeros_core_dev.JSONSchema;
27
+ declare const mapping: _walkeros_core_dev.JSONSchema;
28
+
29
+ type index$1_Mapping = Mapping;
30
+ declare const index$1_MappingSchema: typeof MappingSchema;
31
+ type index$1_Settings = Settings;
32
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
33
+ declare const index$1_mapping: typeof mapping;
34
+ declare const index$1_settings: typeof settings;
35
+ 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 };
37
+ }
38
+
39
+ declare global {
40
+ interface Window {
41
+ _paq?: Array<unknown>;
42
+ }
43
+ }
44
+ interface Env extends DestinationWeb.Env {
45
+ window: {
46
+ _paq: Array<unknown>;
47
+ location?: {
48
+ href?: string;
49
+ };
50
+ };
51
+ document: {
52
+ createElement: (tagName: string) => {
53
+ type: string;
54
+ src: string;
55
+ async?: boolean;
56
+ defer?: boolean;
57
+ };
58
+ head: {
59
+ appendChild: (node: unknown) => void;
60
+ };
61
+ };
62
+ }
63
+
64
+ /**
65
+ * Example environment configurations for Matomo destination.
66
+ * Mocks the _paq command queue and DOM elements for testing
67
+ * without requiring real browser or network.
68
+ */
69
+ declare const init$1: Env | undefined;
70
+ declare const push: Env;
71
+ /**
72
+ * Simulation tracking paths.
73
+ * Specifies which function calls to track during simulation.
74
+ */
75
+ declare const simulation: string[];
76
+
77
+ declare const env_push: typeof push;
78
+ declare const env_simulation: typeof simulation;
79
+ declare namespace env {
80
+ export { init$1 as init, env_push as push, env_simulation as simulation };
81
+ }
82
+
83
+ /**
84
+ * Destination bootstrap.
85
+ * Given the canonical settings, init loads the Matomo script and configures
86
+ * the tracker URL, site ID, and link tracking. Reproduce by passing the same
87
+ * settings to `startFlow` as the destination config.
88
+ */
89
+ declare const init: Flow.StepExample;
90
+ /**
91
+ * Default page view -- no mapping name needed.
92
+ * Destination auto-calls trackPageView with the page title.
93
+ */
94
+ declare const pageView: Flow.StepExample;
95
+ /**
96
+ * Custom event tracking with goal conversion.
97
+ * Uses trackEvent with mapped name, followed by trackGoal.
98
+ */
99
+ declare const customEvent: Flow.StepExample;
100
+ /**
101
+ * Ecommerce order -- one call with cart items array and order totals.
102
+ */
103
+ declare const ecommerceOrder: Flow.StepExample;
104
+ /**
105
+ * Ecommerce cart update -- addEcommerceItem per nested product,
106
+ * then trackEcommerceCartUpdate with cart total.
107
+ */
108
+ declare const ecommerceCartUpdate: Flow.StepExample;
109
+ /**
110
+ * Product detail view -- setEcommerceView equivalent with a single product array.
111
+ */
112
+ declare const productDetailView: Flow.StepExample;
113
+ /**
114
+ * Site search -- trackSiteSearch with keyword, category, result count.
115
+ */
116
+ declare const siteSearch: Flow.StepExample;
117
+ /**
118
+ * Goal tracking alongside a tracked event.
119
+ * Uses a known fixture event (promotion visible) so data paths resolve.
120
+ */
121
+ declare const goalTracking: Flow.StepExample;
122
+
123
+ declare const step_customEvent: typeof customEvent;
124
+ declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
125
+ declare const step_ecommerceOrder: typeof ecommerceOrder;
126
+ declare const step_goalTracking: typeof goalTracking;
127
+ declare const step_init: typeof init;
128
+ declare const step_pageView: typeof pageView;
129
+ declare const step_productDetailView: typeof productDetailView;
130
+ declare const step_siteSearch: typeof siteSearch;
131
+ 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 };
133
+ }
134
+
135
+ declare const index_env: typeof env;
136
+ declare const index_step: typeof step;
137
+ declare namespace index {
138
+ export { index_env as env, index_step as step };
139
+ }
140
+
141
+ export { index as examples, index$1 as schemas };
package/dist/dev.d.ts ADDED
@@ -0,0 +1,141 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { DestinationWeb } from '@walkeros/web-core';
4
+ import { Flow } from '@walkeros/core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ siteId: z.ZodString;
8
+ url: z.ZodString;
9
+ disableCookies: z.ZodDefault<z.ZodBoolean>;
10
+ enableLinkTracking: z.ZodDefault<z.ZodBoolean>;
11
+ enableHeartBeatTimer: z.ZodOptional<z.ZodNumber>;
12
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
+ }, z.core.$strip>;
14
+ type Settings = z.infer<typeof SettingsSchema>;
15
+
16
+ declare const MappingSchema: z.ZodObject<{
17
+ goalId: z.ZodOptional<z.ZodString>;
18
+ goalValue: z.ZodOptional<z.ZodString>;
19
+ siteSearch: z.ZodOptional<z.ZodBoolean>;
20
+ contentImpression: z.ZodOptional<z.ZodBoolean>;
21
+ contentInteraction: z.ZodOptional<z.ZodBoolean>;
22
+ customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
23
+ }, z.core.$strip>;
24
+ type Mapping = z.infer<typeof MappingSchema>;
25
+
26
+ declare const settings: _walkeros_core_dev.JSONSchema;
27
+ declare const mapping: _walkeros_core_dev.JSONSchema;
28
+
29
+ type index$1_Mapping = Mapping;
30
+ declare const index$1_MappingSchema: typeof MappingSchema;
31
+ type index$1_Settings = Settings;
32
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
33
+ declare const index$1_mapping: typeof mapping;
34
+ declare const index$1_settings: typeof settings;
35
+ 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 };
37
+ }
38
+
39
+ declare global {
40
+ interface Window {
41
+ _paq?: Array<unknown>;
42
+ }
43
+ }
44
+ interface Env extends DestinationWeb.Env {
45
+ window: {
46
+ _paq: Array<unknown>;
47
+ location?: {
48
+ href?: string;
49
+ };
50
+ };
51
+ document: {
52
+ createElement: (tagName: string) => {
53
+ type: string;
54
+ src: string;
55
+ async?: boolean;
56
+ defer?: boolean;
57
+ };
58
+ head: {
59
+ appendChild: (node: unknown) => void;
60
+ };
61
+ };
62
+ }
63
+
64
+ /**
65
+ * Example environment configurations for Matomo destination.
66
+ * Mocks the _paq command queue and DOM elements for testing
67
+ * without requiring real browser or network.
68
+ */
69
+ declare const init$1: Env | undefined;
70
+ declare const push: Env;
71
+ /**
72
+ * Simulation tracking paths.
73
+ * Specifies which function calls to track during simulation.
74
+ */
75
+ declare const simulation: string[];
76
+
77
+ declare const env_push: typeof push;
78
+ declare const env_simulation: typeof simulation;
79
+ declare namespace env {
80
+ export { init$1 as init, env_push as push, env_simulation as simulation };
81
+ }
82
+
83
+ /**
84
+ * Destination bootstrap.
85
+ * Given the canonical settings, init loads the Matomo script and configures
86
+ * the tracker URL, site ID, and link tracking. Reproduce by passing the same
87
+ * settings to `startFlow` as the destination config.
88
+ */
89
+ declare const init: Flow.StepExample;
90
+ /**
91
+ * Default page view -- no mapping name needed.
92
+ * Destination auto-calls trackPageView with the page title.
93
+ */
94
+ declare const pageView: Flow.StepExample;
95
+ /**
96
+ * Custom event tracking with goal conversion.
97
+ * Uses trackEvent with mapped name, followed by trackGoal.
98
+ */
99
+ declare const customEvent: Flow.StepExample;
100
+ /**
101
+ * Ecommerce order -- one call with cart items array and order totals.
102
+ */
103
+ declare const ecommerceOrder: Flow.StepExample;
104
+ /**
105
+ * Ecommerce cart update -- addEcommerceItem per nested product,
106
+ * then trackEcommerceCartUpdate with cart total.
107
+ */
108
+ declare const ecommerceCartUpdate: Flow.StepExample;
109
+ /**
110
+ * Product detail view -- setEcommerceView equivalent with a single product array.
111
+ */
112
+ declare const productDetailView: Flow.StepExample;
113
+ /**
114
+ * Site search -- trackSiteSearch with keyword, category, result count.
115
+ */
116
+ declare const siteSearch: Flow.StepExample;
117
+ /**
118
+ * Goal tracking alongside a tracked event.
119
+ * Uses a known fixture event (promotion visible) so data paths resolve.
120
+ */
121
+ declare const goalTracking: Flow.StepExample;
122
+
123
+ declare const step_customEvent: typeof customEvent;
124
+ declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
125
+ declare const step_ecommerceOrder: typeof ecommerceOrder;
126
+ declare const step_goalTracking: typeof goalTracking;
127
+ declare const step_init: typeof init;
128
+ declare const step_pageView: typeof pageView;
129
+ declare const step_productDetailView: typeof productDetailView;
130
+ declare const step_siteSearch: typeof siteSearch;
131
+ 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 };
133
+ }
134
+
135
+ declare const index_env: typeof env;
136
+ declare const index_step: typeof step;
137
+ declare namespace index {
138
+ export { index_env as env, index_step as step };
139
+ }
140
+
141
+ export { index as examples, index$1 as schemas };
package/dist/dev.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,a=Object.defineProperty,t=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var i in t)a(e,i,{get:t[i],enumerable:!0})},n={};o(n,{examples:()=>k,schemas:()=>s}),module.exports=(e=n,((e,o,n,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of i(o))r.call(e,c)||c===n||a(e,c,{get:()=>o[c],enumerable:!(s=t(o,c))||s.enumerable});return e})(a({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>l,SettingsSchema:()=>d,mapping:()=>g,settings:()=>u});var c=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" })')}),m=require("@walkeros/core/dev"),l=m.z.object({goalId:m.z.string().optional().describe("Goal ID to track a conversion alongside this event (like 1)"),goalValue:m.z.string().optional().describe("Property path for goal revenue value (like data.revenue)"),siteSearch:m.z.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:m.z.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:m.z.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:m.z.record(m.z.string(),m.z.string()).optional().describe('Per-event custom dimension ID to property path mapping (like { "3": "data.category" })')}),u=(0,c.zodToSchema)(d),g=(0,c.zodToSchema)(l),k={};o(k,{env:()=>h,step:()=>w});var h={};o(h,{init:()=>v,push:()=>y,simulation:()=>b});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:()=>{}}}},b=["call:window._paq.push"],w={};o(w,{customEvent:()=>z,ecommerceCartUpdate:()=>_,ecommerceOrder:()=>f,goalTracking:()=>O,init:()=>S,pageView:()=>E,productDetailView:()=>I,siteSearch:()=>C});var q=require("@walkeros/core"),S={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"]]]},E={in:(0,q.getEvent)("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},z={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]]]},f={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}]]]},_={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={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={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={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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.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ev","init"]}
package/dist/dev.mjs ADDED
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,a=(a,t)=>{for(var i in t)e(a,i,{get:t[i],enumerable:!0})},t={};a(t,{MappingSchema:()=>s,SettingsSchema:()=>r,mapping:()=>p,settings:()=>c});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 s=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" })')}),c=i(r),p=i(s),d={};a(d,{env:()=>m,step:()=>k});var m={};a(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={};a(k,{customEvent:()=>w,ecommerceCartUpdate:()=>S,ecommerceOrder:()=>q,goalTracking:()=>E,init:()=>y,pageView:()=>b,productDetailView:()=>f,siteSearch:()=>_});import{getEvent as h,isObject as v}from"@walkeros/core";var y={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"]]]},b={in:h("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},w={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]]]},q={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={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]]]},f={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}]]]]},_={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]]]},E={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,t as schemas};//# sourceMappingURL=dev.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n siteId: z.string().min(1).describe('Matomo Site ID (like 1, 2, etc.)'),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance (like https://analytics.example.com/ or https://yourname.matomo.cloud/)',\n ),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Custom dimension ID to property path mapping applied to all events (like { \"1\": \"data.userType\" })',\n ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z\n .string()\n .optional()\n .describe('Goal ID to track a conversion alongside this event (like 1)'),\n goalValue: z\n .string()\n .optional()\n .describe('Property path for goal revenue value (like data.revenue)'),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Per-event custom dimension ID to property path mapping (like { \"3\": \"data.category\" })',\n ),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent, isObject } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: Flow.StepExample = {\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: Flow.StepExample = {\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: Flow.StepExample = {\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: 'goal_1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', 'goal_1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n */\nexport const ecommerceOrder: Flow.StepExample = {\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- addEcommerceItem per nested product,\n * then trackEcommerceCartUpdate with cart total.\n */\nexport const ecommerceCartUpdate: Flow.StepExample = {\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n isObject(entity) && entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view -- setEcommerceView equivalent with a single product array.\n */\nexport const productDetailView: Flow.StepExample = {\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: Flow.StepExample = {\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: Flow.StepExample = {\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,kCAAkC;AAAA,EACrE,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,gBAAgB,EACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,EACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,EACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,kBAAkB,EACf,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;AChCD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,QAAQA,GACL,OAAO,EACP,SAAS,EACT,SAAS,6DAA6D;AAAA,EACzE,WAAWA,GACR,OAAO,EACP,SAAS,EACT,SAAS,0DAA0D;AAAA,EACtE,YAAYA,GACT,QAAQ,EACR,SAAS,EACT,SAAS,qDAAqD;AAAA,EACjE,mBAAmBA,GAChB,QAAQ,EACR,SAAS,EACT,SAAS,0DAA0D;AAAA,EACtE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AAA,IACA,MAAM;AAAA,MACJ,KAAK,CAAC,WAAW;AAAA,IACnB;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,cAAc,4BAA4B,CAAC;AAAA,IAC1D,CAAC,aAAa,CAAC,aAAa,KAAK,EAAE,CAAC;AAAA,EACtC;AACF;","names":["z","init"]}
@@ -0,0 +1,100 @@
1
+ import { DestinationWeb } from '@walkeros/web-core';
2
+ import { Flow } from '@walkeros/core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ _paq?: Array<unknown>;
7
+ }
8
+ }
9
+ interface Env extends DestinationWeb.Env {
10
+ window: {
11
+ _paq: Array<unknown>;
12
+ location?: {
13
+ href?: string;
14
+ };
15
+ };
16
+ document: {
17
+ createElement: (tagName: string) => {
18
+ type: string;
19
+ src: string;
20
+ async?: boolean;
21
+ defer?: boolean;
22
+ };
23
+ head: {
24
+ appendChild: (node: unknown) => void;
25
+ };
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Example environment configurations for Matomo destination.
31
+ * Mocks the _paq command queue and DOM elements for testing
32
+ * without requiring real browser or network.
33
+ */
34
+ declare const init$1: Env | undefined;
35
+ declare const push: Env;
36
+ /**
37
+ * Simulation tracking paths.
38
+ * Specifies which function calls to track during simulation.
39
+ */
40
+ declare const simulation: string[];
41
+
42
+ declare const env_push: typeof push;
43
+ declare const env_simulation: typeof simulation;
44
+ declare namespace env {
45
+ export { init$1 as init, env_push as push, env_simulation as simulation };
46
+ }
47
+
48
+ /**
49
+ * Destination bootstrap.
50
+ * Given the canonical settings, init loads the Matomo script and configures
51
+ * the tracker URL, site ID, and link tracking. Reproduce by passing the same
52
+ * settings to `startFlow` as the destination config.
53
+ */
54
+ declare const init: Flow.StepExample;
55
+ /**
56
+ * Default page view -- no mapping name needed.
57
+ * Destination auto-calls trackPageView with the page title.
58
+ */
59
+ declare const pageView: Flow.StepExample;
60
+ /**
61
+ * Custom event tracking with goal conversion.
62
+ * Uses trackEvent with mapped name, followed by trackGoal.
63
+ */
64
+ declare const customEvent: Flow.StepExample;
65
+ /**
66
+ * Ecommerce order -- one call with cart items array and order totals.
67
+ */
68
+ declare const ecommerceOrder: Flow.StepExample;
69
+ /**
70
+ * Ecommerce cart update -- addEcommerceItem per nested product,
71
+ * then trackEcommerceCartUpdate with cart total.
72
+ */
73
+ declare const ecommerceCartUpdate: Flow.StepExample;
74
+ /**
75
+ * Product detail view -- setEcommerceView equivalent with a single product array.
76
+ */
77
+ declare const productDetailView: Flow.StepExample;
78
+ /**
79
+ * Site search -- trackSiteSearch with keyword, category, result count.
80
+ */
81
+ declare const siteSearch: Flow.StepExample;
82
+ /**
83
+ * Goal tracking alongside a tracked event.
84
+ * Uses a known fixture event (promotion visible) so data paths resolve.
85
+ */
86
+ declare const goalTracking: Flow.StepExample;
87
+
88
+ declare const step_customEvent: typeof customEvent;
89
+ declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
90
+ declare const step_ecommerceOrder: typeof ecommerceOrder;
91
+ declare const step_goalTracking: typeof goalTracking;
92
+ declare const step_init: typeof init;
93
+ declare const step_pageView: typeof pageView;
94
+ declare const step_productDetailView: typeof productDetailView;
95
+ declare const step_siteSearch: typeof siteSearch;
96
+ declare namespace step {
97
+ 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 };
98
+ }
99
+
100
+ export { env, step };
@@ -0,0 +1,100 @@
1
+ import { DestinationWeb } from '@walkeros/web-core';
2
+ import { Flow } from '@walkeros/core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ _paq?: Array<unknown>;
7
+ }
8
+ }
9
+ interface Env extends DestinationWeb.Env {
10
+ window: {
11
+ _paq: Array<unknown>;
12
+ location?: {
13
+ href?: string;
14
+ };
15
+ };
16
+ document: {
17
+ createElement: (tagName: string) => {
18
+ type: string;
19
+ src: string;
20
+ async?: boolean;
21
+ defer?: boolean;
22
+ };
23
+ head: {
24
+ appendChild: (node: unknown) => void;
25
+ };
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Example environment configurations for Matomo destination.
31
+ * Mocks the _paq command queue and DOM elements for testing
32
+ * without requiring real browser or network.
33
+ */
34
+ declare const init$1: Env | undefined;
35
+ declare const push: Env;
36
+ /**
37
+ * Simulation tracking paths.
38
+ * Specifies which function calls to track during simulation.
39
+ */
40
+ declare const simulation: string[];
41
+
42
+ declare const env_push: typeof push;
43
+ declare const env_simulation: typeof simulation;
44
+ declare namespace env {
45
+ export { init$1 as init, env_push as push, env_simulation as simulation };
46
+ }
47
+
48
+ /**
49
+ * Destination bootstrap.
50
+ * Given the canonical settings, init loads the Matomo script and configures
51
+ * the tracker URL, site ID, and link tracking. Reproduce by passing the same
52
+ * settings to `startFlow` as the destination config.
53
+ */
54
+ declare const init: Flow.StepExample;
55
+ /**
56
+ * Default page view -- no mapping name needed.
57
+ * Destination auto-calls trackPageView with the page title.
58
+ */
59
+ declare const pageView: Flow.StepExample;
60
+ /**
61
+ * Custom event tracking with goal conversion.
62
+ * Uses trackEvent with mapped name, followed by trackGoal.
63
+ */
64
+ declare const customEvent: Flow.StepExample;
65
+ /**
66
+ * Ecommerce order -- one call with cart items array and order totals.
67
+ */
68
+ declare const ecommerceOrder: Flow.StepExample;
69
+ /**
70
+ * Ecommerce cart update -- addEcommerceItem per nested product,
71
+ * then trackEcommerceCartUpdate with cart total.
72
+ */
73
+ declare const ecommerceCartUpdate: Flow.StepExample;
74
+ /**
75
+ * Product detail view -- setEcommerceView equivalent with a single product array.
76
+ */
77
+ declare const productDetailView: Flow.StepExample;
78
+ /**
79
+ * Site search -- trackSiteSearch with keyword, category, result count.
80
+ */
81
+ declare const siteSearch: Flow.StepExample;
82
+ /**
83
+ * Goal tracking alongside a tracked event.
84
+ * Uses a known fixture event (promotion visible) so data paths resolve.
85
+ */
86
+ declare const goalTracking: Flow.StepExample;
87
+
88
+ declare const step_customEvent: typeof customEvent;
89
+ declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
90
+ declare const step_ecommerceOrder: typeof ecommerceOrder;
91
+ declare const step_goalTracking: typeof goalTracking;
92
+ declare const step_init: typeof init;
93
+ declare const step_pageView: typeof pageView;
94
+ declare const step_productDetailView: typeof productDetailView;
95
+ declare const step_siteSearch: typeof siteSearch;
96
+ declare namespace step {
97
+ 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 };
98
+ }
99
+
100
+ export { env, step };