@walkeros/web-destination-matomo 4.8.1 → 4.8.2
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 +42 -0
- package/dist/dev.d.mts +19 -15
- package/dist/dev.d.ts +19 -15
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +18 -14
- package/dist/examples/index.d.ts +18 -14
- package/dist/examples/index.js +28 -23
- package/dist/examples/index.mjs +29 -24
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +0 -11
- package/dist/index.d.ts +0 -11
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +140 -32
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @walkeros/web-destination-matomo
|
|
2
2
|
|
|
3
|
+
## 4.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2374f54: An event that no rule maps fails with `missing-input` instead of a
|
|
8
|
+
warning. An invalid `goalId` sends the hit without the goal and logs one ERROR
|
|
9
|
+
per cause. A consent revocation sends `forgetConsentGiven`, stopping link
|
|
10
|
+
tracking too, and silent rules send only their goal.
|
|
11
|
+
- 2374f54: A destination with `config.consent` now tells the vendor about
|
|
12
|
+
consent changes: Meta calls `fbq('consent', 'revoke' | 'grant')`, Matomo
|
|
13
|
+
`forgetConsentGiven` and `setConsentGiven`, Clarity sends ConsentV2, FullStory
|
|
14
|
+
stops and starts capture, and Piwik PRO turns off the link tracking it
|
|
15
|
+
enabled.
|
|
16
|
+
- 2374f54: A failed vendor call, a missing required setting (`config`) and an
|
|
17
|
+
event that cannot be sent (`missing-input`) are reported as failed pushes,
|
|
18
|
+
with the dead-letter queue and one ERROR line, instead of counting as
|
|
19
|
+
delivered. Rules with `silent: true` send no event. Settings schemas reject
|
|
20
|
+
unknown keys.
|
|
21
|
+
- b1d65e2: Web destinations that load a vendor script inject it through the
|
|
22
|
+
document of their `env`, so simulation and server-side rendering work without
|
|
23
|
+
a browser page. A page still gets the script in its own document by default,
|
|
24
|
+
and a missing document fails the push with `vendor-not-ready`.
|
|
25
|
+
- 2374f54: Vendor scripts load through walkerOS: a blocked or slow script fails
|
|
26
|
+
later events visibly (`vendor-not-loaded`, `vendor-timeout`) instead of losing
|
|
27
|
+
them. Pushes made while the script loads wait for it, and each script is
|
|
28
|
+
injected once per page.
|
|
29
|
+
- Updated dependencies [2374f54]
|
|
30
|
+
- Updated dependencies [7e5fc27]
|
|
31
|
+
- Updated dependencies [2374f54]
|
|
32
|
+
- Updated dependencies [964590a]
|
|
33
|
+
- Updated dependencies [4100ede]
|
|
34
|
+
- Updated dependencies [2374f54]
|
|
35
|
+
- Updated dependencies [2374f54]
|
|
36
|
+
- Updated dependencies [15eb7b2]
|
|
37
|
+
- Updated dependencies [33a2779]
|
|
38
|
+
- Updated dependencies [33a2779]
|
|
39
|
+
- Updated dependencies [b1d65e2]
|
|
40
|
+
- Updated dependencies [964590a]
|
|
41
|
+
- Updated dependencies [2374f54]
|
|
42
|
+
- @walkeros/core@4.8.2
|
|
43
|
+
- @walkeros/web-core@4.8.2
|
|
44
|
+
|
|
3
45
|
## 4.8.1
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/dist/dev.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
10
10
|
enableLinkTracking: z.ZodDefault<z.ZodBoolean>;
|
|
11
11
|
enableHeartBeatTimer: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
13
|
-
}, z.core.$
|
|
13
|
+
}, z.core.$strict>;
|
|
14
14
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
15
15
|
|
|
16
16
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -63,23 +63,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
63
63
|
href?: string;
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
document: {
|
|
67
|
-
createElement: (tagName: string) => {
|
|
68
|
-
type: string;
|
|
69
|
-
src: string;
|
|
70
|
-
async?: boolean;
|
|
71
|
-
defer?: boolean;
|
|
72
|
-
};
|
|
73
|
-
head: {
|
|
74
|
-
appendChild: (node: unknown) => void;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
66
|
}
|
|
78
67
|
|
|
79
68
|
/**
|
|
80
69
|
* Example environment configurations for Matomo destination.
|
|
81
|
-
* Mocks the _paq command queue
|
|
82
|
-
*
|
|
70
|
+
* Mocks the _paq command queue for testing without requiring real browser
|
|
71
|
+
* or network.
|
|
83
72
|
*/
|
|
84
73
|
declare const init$1: Env | undefined;
|
|
85
74
|
declare const push: Env;
|
|
@@ -159,8 +148,21 @@ declare const goalTracking: StepExample;
|
|
|
159
148
|
* example stays out of them.
|
|
160
149
|
*/
|
|
161
150
|
declare const customDimensions: StepExample;
|
|
151
|
+
/** A silent rule without a goal sends nothing. */
|
|
152
|
+
declare const silentRule: StepExample;
|
|
153
|
+
/**
|
|
154
|
+
* An event no rule maps: Matomo has no command for it, so the push fails
|
|
155
|
+
* instead of counting as delivered.
|
|
156
|
+
*/
|
|
157
|
+
declare const unmappedEvent: StepExample;
|
|
158
|
+
/**
|
|
159
|
+
* A revocation of the consent the destination requires stops Matomo:
|
|
160
|
+
* config.consent { marketing: true }, granted first, then revoked.
|
|
161
|
+
*/
|
|
162
|
+
declare const consentRevoke: StepExample;
|
|
162
163
|
|
|
163
164
|
type step_StepExample = StepExample;
|
|
165
|
+
declare const step_consentRevoke: typeof consentRevoke;
|
|
164
166
|
declare const step_customDimensions: typeof customDimensions;
|
|
165
167
|
declare const step_customEvent: typeof customEvent;
|
|
166
168
|
declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
|
|
@@ -170,9 +172,11 @@ declare const step_init: typeof init;
|
|
|
170
172
|
declare const step_pageView: typeof pageView;
|
|
171
173
|
declare const step_pageViewWithGoal: typeof pageViewWithGoal;
|
|
172
174
|
declare const step_productDetailView: typeof productDetailView;
|
|
175
|
+
declare const step_silentRule: typeof silentRule;
|
|
173
176
|
declare const step_siteSearch: typeof siteSearch;
|
|
177
|
+
declare const step_unmappedEvent: typeof unmappedEvent;
|
|
174
178
|
declare namespace step {
|
|
175
|
-
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 };
|
|
179
|
+
export { type step_StepExample as StepExample, step_consentRevoke as consentRevoke, 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_silentRule as silentRule, step_siteSearch as siteSearch, step_unmappedEvent as unmappedEvent };
|
|
176
180
|
}
|
|
177
181
|
|
|
178
182
|
declare const index_env: typeof env;
|
package/dist/dev.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const SettingsSchema: z.ZodObject<{
|
|
|
10
10
|
enableLinkTracking: z.ZodDefault<z.ZodBoolean>;
|
|
11
11
|
enableHeartBeatTimer: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
customDimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
13
|
-
}, z.core.$
|
|
13
|
+
}, z.core.$strict>;
|
|
14
14
|
type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
15
15
|
|
|
16
16
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -63,23 +63,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
63
63
|
href?: string;
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
document: {
|
|
67
|
-
createElement: (tagName: string) => {
|
|
68
|
-
type: string;
|
|
69
|
-
src: string;
|
|
70
|
-
async?: boolean;
|
|
71
|
-
defer?: boolean;
|
|
72
|
-
};
|
|
73
|
-
head: {
|
|
74
|
-
appendChild: (node: unknown) => void;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
66
|
}
|
|
78
67
|
|
|
79
68
|
/**
|
|
80
69
|
* Example environment configurations for Matomo destination.
|
|
81
|
-
* Mocks the _paq command queue
|
|
82
|
-
*
|
|
70
|
+
* Mocks the _paq command queue for testing without requiring real browser
|
|
71
|
+
* or network.
|
|
83
72
|
*/
|
|
84
73
|
declare const init$1: Env | undefined;
|
|
85
74
|
declare const push: Env;
|
|
@@ -159,8 +148,21 @@ declare const goalTracking: StepExample;
|
|
|
159
148
|
* example stays out of them.
|
|
160
149
|
*/
|
|
161
150
|
declare const customDimensions: StepExample;
|
|
151
|
+
/** A silent rule without a goal sends nothing. */
|
|
152
|
+
declare const silentRule: StepExample;
|
|
153
|
+
/**
|
|
154
|
+
* An event no rule maps: Matomo has no command for it, so the push fails
|
|
155
|
+
* instead of counting as delivered.
|
|
156
|
+
*/
|
|
157
|
+
declare const unmappedEvent: StepExample;
|
|
158
|
+
/**
|
|
159
|
+
* A revocation of the consent the destination requires stops Matomo:
|
|
160
|
+
* config.consent { marketing: true }, granted first, then revoked.
|
|
161
|
+
*/
|
|
162
|
+
declare const consentRevoke: StepExample;
|
|
162
163
|
|
|
163
164
|
type step_StepExample = StepExample;
|
|
165
|
+
declare const step_consentRevoke: typeof consentRevoke;
|
|
164
166
|
declare const step_customDimensions: typeof customDimensions;
|
|
165
167
|
declare const step_customEvent: typeof customEvent;
|
|
166
168
|
declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
|
|
@@ -170,9 +172,11 @@ declare const step_init: typeof init;
|
|
|
170
172
|
declare const step_pageView: typeof pageView;
|
|
171
173
|
declare const step_pageViewWithGoal: typeof pageViewWithGoal;
|
|
172
174
|
declare const step_productDetailView: typeof productDetailView;
|
|
175
|
+
declare const step_silentRule: typeof silentRule;
|
|
173
176
|
declare const step_siteSearch: typeof siteSearch;
|
|
177
|
+
declare const step_unmappedEvent: typeof unmappedEvent;
|
|
174
178
|
declare namespace step {
|
|
175
|
-
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 };
|
|
179
|
+
export { type step_StepExample as StepExample, step_consentRevoke as consentRevoke, 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_silentRule as silentRule, step_siteSearch as siteSearch, step_unmappedEvent as unmappedEvent };
|
|
176
180
|
}
|
|
177
181
|
|
|
178
182
|
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,o=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},r={};n(r,{examples:()=>
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},r={};n(r,{examples:()=>k,schemas:()=>s}),module.exports=(e=r,((e,n,r,s)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let c of i(n))o.call(e,c)||c===r||t(e,c,{get:()=>n[c],enumerable:!(s=a(n,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};n(s,{MappingSchema:()=>g,SettingsSchema:()=>m,mapping:()=>v,settings:()=>h});var c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),{ValueSchema:d}=p.schemas,l=p.z.record(p.z.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),d),m=p.z.object({siteId:p.z.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:p.z.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),disableCookies:p.z.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:p.z.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:p.z.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:l.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()}).strict(),u=require("@walkeros/core/dev"),g=u.z.object({goalId:u.z.union([u.z.string().regex(/^[1-9]\d*$/,'Goal IDs are positive integers like "1"'),u.z.number().int().positive()]).optional().describe("Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event"),goalValue:u.schemas.ValueSchema.describe('Goal revenue, resolved from the event (like "data.revenue"), passed as the trackGoal revenue').optional(),siteSearch:u.z.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:u.z.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:u.z.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:l.describe('Custom dimensions for this rule, keyed by bare dimension id (like { "3": "data.category" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.').optional()}),h=(0,c.zodToSchema)(m),v=(0,c.zodToSchema)(g),k={};n(k,{env:()=>w,step:()=>q});var w={};n(w,{init:()=>b,push:()=>y,simulation:()=>f});var b={window:{location:{href:"https://www.example.com/page"}}},y={window:{_paq:[],location:{href:"https://www.example.com/page"}}},f=["call:window._paq.push"],q={};n(q,{consentRevoke:()=>O,customDimensions:()=>x,customEvent:()=>D,ecommerceCartUpdate:()=>I,ecommerceOrder:()=>z,goalTracking:()=>V,init:()=>S,pageView:()=>_,pageViewWithGoal:()=>C,productDetailView:()=>M,silentRule:()=>P,siteSearch:()=>T,unmappedEvent:()=>G});var E=require("@walkeros/core"),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"]]]},_={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:(0,E.getEvent)("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},C={title:"Page view with goal",description:"A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.",in:(0,E.getEvent)("page view",{timestamp:1700000407}),mapping:{settings:{goalId:"1"}},out:[["_paq.push",["trackPageView","walkerOS documentation"]],["_paq.push",["trackGoal","1",void 0]]]},D={title:"Custom event with goal",description:"A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.",in:(0,E.getEvent)("promotion visible",{timestamp:1700000401}),mapping:{name:"trackEvent",settings:{goalId:"1"},data:{set:["data.name","data.position"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily","hero"]],["_paq.push",["trackGoal","1",void 0]]]},z={public:!1,title:"Ecommerce order",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",in:(0,E.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},{map:{orderId:"data.id",grandTotal:"data.value",tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["_paq.push",["trackEcommerceOrder",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1},{sku:"cc",name:"Cool Cap",category:"",price:42,quantity:1}],{orderId:"0rd3r1d",grandTotal:555,tax:73.76,shipping:5.22}]]]},I={public:!1,title:"Cart update",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",in:(0,E.getEvent)("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},"data.value"]}},out:[["_paq.push",["trackEcommerceCartUpdate",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1}],840]]]},M={public:!1,title:"Product detail view",description:"Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",in:(0,E.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}]]]]},T={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:(0,E.createEvent)({name:"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,E.getEvent)("promotion visible",{timestamp:1700000406,data:{name:"Setting up tracking easily",position:"hero",value:50}}),mapping:{name:"trackEvent",settings:{goalId:"1",goalValue:"data.value"},data:{set:["data.name"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily"]],["_paq.push",["trackGoal","1",50]]]},x={title:"Custom dimensions",description:"Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.",public:!1,in:(0,E.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"]]]},P={public:!1,description:"A rule with silent: true and no goal sends no command, its dimensions included.",in:(0,E.getEvent)("page view",{timestamp:1700000300}),mapping:{silent:!0},out:[]},G={public:!1,description:"An event without a rule name, a tracking flag or a goal, and not a page view, has no Matomo command: the push fails with missing-input.",in:(0,E.getEvent)("product view",{timestamp:1700000301}),out:[],outcome:{status:"failed",code:"missing-input",retryable:!1}},O={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing pushes forgetConsentGiven, which stops every tracking request of the page, link tracking included.",command:"consent",in:{marketing:!1},out:[["window._paq.push",["forgetConsentGiven"]]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Matomo Site ID (like 1, 2, etc.). Required when loadScript is true',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true',\n )\n .optional(),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: CustomDimensionsSchema.describe(\n 'Custom dimensions applied to every hit, keyed by bare dimension id (like { \"1\": \"data.userType\" }). Each value is resolved per event. Rule-level customDimensions win per key.',\n ).optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { schemas, z } from '@walkeros/core/dev';\nimport { CustomDimensionsSchema } from './settings';\n\nexport const MappingSchema = z.object({\n goalId: z\n .union([\n z.string().regex(/^[1-9]\\d*$/, 'Goal IDs are positive integers like \"1\"'),\n z.number().int().positive(),\n ])\n .optional()\n .describe(\n 'Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event',\n ),\n goalValue: schemas.ValueSchema.describe(\n 'Goal revenue, resolved from the event (like \"data.revenue\"), passed as the trackGoal revenue',\n ).optional(),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: CustomDimensionsSchema.describe(\n 'Custom dimensions for this rule, keyed by bare dimension id (like { \"3\": \"data.category\" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.',\n ).optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n // _paq absent: init() is expected to install the queue.\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport type { Settings } from '../types';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n * Not public: Matomo records an order's products only after an\n * addEcommerceItem call per product, which one rule cannot send, so this\n * shows mapping mechanics only.\n */\nexport const ecommerceOrder: StepExample = {\n public: false,\n title: 'Ecommerce order',\n description:\n \"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.\",\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- nested products and the cart total in one call.\n * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an\n * addEcommerceItem call per product, which one rule cannot send.\n */\nexport const ecommerceCartUpdate: StepExample = {\n public: false,\n title: 'Cart update',\n description:\n 'Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view with a single product array.\n * Not public: Matomo has no ecommerceProductDetailView; it tracks a product\n * view with setEcommerceView followed by trackPageView, two commands.\n */\nexport const productDetailView: StepExample = {\n public: false,\n title: 'Product detail view',\n description:\n 'Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: StepExample = {\n title: 'Goal with value',\n description:\n 'A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.',\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n\n/**\n * Destination and rule custom dimensions, resolved per event. The destination\n * dimensions come from `settings`, which the docs do not show, so this\n * example stays out of them.\n */\nexport const customDimensions: StepExample = {\n title: 'Custom dimensions',\n description:\n 'Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.',\n public: false,\n in: getEvent('page view', { timestamp: 1700000408 }),\n settings: {\n customDimensions: { '1': 'globals.pagegroup' },\n },\n mapping: {\n settings: {\n customDimensions: { '2': 'data.id' },\n },\n },\n out: [\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ['_paq.push', ['setCustomDimension', 2, '/docs/']],\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['deleteCustomDimension', 2]],\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAA2B;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,aAAE;AAAA,EACtC,aAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,aACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,aACjB,QAAQ,EACR,QAAQ,IAAI,EACZ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Q;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"]}
|
|
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\n .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 .strict();\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 for testing without requiring real browser\n * 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};\n\nexport const push: Env = {\n window: {\n _paq: [],\n location: { href: 'https://www.example.com/page' },\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 { createEvent, getEvent } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n * Not public: Matomo records an order's products only after an\n * addEcommerceItem call per product, which one rule cannot send, so this\n * shows mapping mechanics only.\n */\nexport const ecommerceOrder: StepExample = {\n public: false,\n title: 'Ecommerce order',\n description:\n \"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.\",\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.value',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- nested products and the cart total in one call.\n * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an\n * addEcommerceItem call per product, which one rule cannot send.\n */\nexport const ecommerceCartUpdate: StepExample = {\n public: false,\n title: 'Cart update',\n description:\n 'Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view with a single product array.\n * Not public: Matomo has no ecommerceProductDetailView; it tracks a product\n * view with setEcommerceView followed by trackPageView, two commands.\n */\nexport const productDetailView: StepExample = {\n public: false,\n title: 'Product detail view',\n description:\n 'Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: createEvent({\n name: '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\n/** A silent rule without a goal sends nothing. */\nexport const silentRule: StepExample = {\n public: false,\n description:\n 'A rule with silent: true and no goal sends no command, its dimensions included.',\n in: getEvent('page view', { timestamp: 1700000300 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * An event no rule maps: Matomo has no command for it, so the push fails\n * instead of counting as delivered.\n */\nexport const unmappedEvent: StepExample = {\n public: false,\n description:\n 'An event without a rule name, a tracking flag or a goal, and not a page view, has no Matomo command: the push fails with missing-input.',\n in: getEvent('product view', { timestamp: 1700000301 }),\n out: [],\n outcome: { status: 'failed', code: 'missing-input', retryable: false },\n};\n\n/**\n * A revocation of the consent the destination requires stops Matomo:\n * config.consent { marketing: true }, granted first, then revoked.\n */\nexport const consentRevoke: StepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing pushes forgetConsentGiven, which stops every tracking request of the page, link tracking included.',\n command: 'consent',\n in: { marketing: false },\n out: [['window._paq.push', ['forgetConsentGiven']]],\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,aAC3B,OAAO;AAAA,EACN,QAAQ,aACL,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,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;AACpD;","names":["import_dev","import_dev","init"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>m,SettingsSchema:()=>c,mapping:()=>u,settings:()=>l});import{zodToSchema as i}from"@walkeros/core/dev";import{schemas as o,z as n}from"@walkeros/core/dev";var{ValueSchema:r}=o,s=n.record(n.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),r),c=n.object({siteId:n.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:n.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),disableCookies:n.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:n.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:n.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:s.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()});import{schemas as p,z as d}from"@walkeros/core/dev";var m=d.object({goalId:d.union([d.string().regex(/^[1-9]\d*$/,'Goal IDs are positive integers like "1"'),d.number().int().positive()]).optional().describe("Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event"),goalValue:p.ValueSchema.describe('Goal revenue, resolved from the event (like "data.revenue"), passed as the trackGoal revenue').optional(),siteSearch:d.boolean().optional().describe("Track as internal site search using trackSiteSearch"),contentImpression:d.boolean().optional().describe("Track as content impression using trackContentImpression"),contentInteraction:d.boolean().optional().describe("Track as content interaction using trackContentInteraction"),customDimensions:s.describe('Custom dimensions for this rule, keyed by bare dimension id (like { "3": "data.category" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.').optional()}),l=i(c),u=i(m),g={};t(g,{env:()=>h,step:()=>
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>m,SettingsSchema:()=>c,mapping:()=>u,settings:()=>l});import{zodToSchema as i}from"@walkeros/core/dev";import{schemas as o,z as n}from"@walkeros/core/dev";var{ValueSchema:r}=o,s=n.record(n.string().regex(/^\d+$/,'Dimension keys are bare numeric ids like "1"'),r),c=n.object({siteId:n.string().min(1).describe("Matomo Site ID (like 1, 2, etc.). Required when loadScript is true").optional(),url:n.string().url().describe("Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true").optional(),disableCookies:n.boolean().default(!1).describe("Disable all tracking cookies for cookie-free analytics"),enableLinkTracking:n.boolean().default(!0).describe("Enable automatic outlink and download tracking"),enableHeartBeatTimer:n.number().int().positive().optional().describe("Enable heart beat timer with interval in seconds for accurate time-on-page"),customDimensions:s.describe('Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.').optional()}).strict();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:()=>b});var h={};t(h,{init:()=>k,push:()=>v,simulation:()=>w});var k={window:{location:{href:"https://www.example.com/page"}}},v={window:{_paq:[],location:{href:"https://www.example.com/page"}}},w=["call:window._paq.push"],b={};t(b,{consentRevoke:()=>P,customDimensions:()=>x,customEvent:()=>C,ecommerceCartUpdate:()=>D,ecommerceOrder:()=>_,goalTracking:()=>V,init:()=>q,pageView:()=>S,pageViewWithGoal:()=>E,productDetailView:()=>I,silentRule:()=>T,siteSearch:()=>M,unmappedEvent:()=>G});import{createEvent as y,getEvent as f}from"@walkeros/core";var q={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"]]]},S={title:"Page view",description:"A page view is tracked in Matomo via trackPageView with the page title from event data.",in:f("page view",{timestamp:1700000400}),mapping:{data:"data.title"},out:[["_paq.push",["trackPageView","walkerOS documentation"]]]},E={title:"Page view with goal",description:"A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.",in:f("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:f("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]]]},_={public:!1,title:"Ecommerce order",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.",in:f("order complete",{timestamp:1700000402}),mapping:{name:"trackEcommerceOrder",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},{map:{orderId:"data.id",grandTotal:"data.value",tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["_paq.push",["trackEcommerceOrder",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1},{sku:"cc",name:"Cool Cap",category:"",price:42,quantity:1}],{orderId:"0rd3r1d",grandTotal:555,tax:73.76,shipping:5.22}]]]},D={public:!1,title:"Cart update",description:"Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.",in:f("cart view",{timestamp:1700000403}),mapping:{name:"trackEcommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>"object"==typeof e&&null!==e&&"entity"in e&&"product"===e.entity,map:{sku:"data.id",name:"data.name",category:{value:""},price:"data.price",quantity:{value:1}}}]},"data.value"]}},out:[["_paq.push",["trackEcommerceCartUpdate",[{sku:"ers",name:"Everyday Ruck Snack",category:"",price:420,quantity:1}],840]]]},I={public:!1,title:"Product detail view",description:"Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.",in:f("product view",{timestamp:1700000404}),mapping:{name:"ecommerceProductDetailView",data:{set:[{set:[{map:{sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1}}}]}]}},out:[["_paq.push",["ecommerceProductDetailView",[{sku:"ers",name:"Everyday Ruck Snack",price:420,quantity:1}]]]]},M={title:"Site search",description:"A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",in:y({name:"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:f("promotion visible",{timestamp:1700000406,data:{name:"Setting up tracking easily",position:"hero",value:50}}),mapping:{name:"trackEvent",settings:{goalId:"1",goalValue:"data.value"},data:{set:["data.name"]}},out:[["_paq.push",["trackEvent","Setting up tracking easily"]],["_paq.push",["trackGoal","1",50]]]},x={title:"Custom dimensions",description:"Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.",public:!1,in:f("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"]]]},T={public:!1,description:"A rule with silent: true and no goal sends no command, its dimensions included.",in:f("page view",{timestamp:1700000300}),mapping:{silent:!0},out:[]},G={public:!1,description:"An event without a rule name, a tracking flag or a goal, and not a page view, has no Matomo command: the push fails with missing-input.",in:f("product view",{timestamp:1700000301}),out:[],outcome:{status:"failed",code:"missing-input",retryable:!1}},P={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing pushes forgetConsentGiven, which stops every tracking request of the page, link tracking included.",command:"consent",in:{marketing:!1},out:[["window._paq.push",["forgetConsentGiven"]]]};export{g as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z.object({\n siteId: z\n .string()\n .min(1)\n .describe(\n 'Matomo Site ID (like 1, 2, etc.). Required when loadScript is true',\n )\n .optional(),\n url: z\n .string()\n .url()\n .describe(\n 'Base URL of your Matomo instance, normalized to one trailing slash (like https://analytics.example.com/ or https://yourname.matomo.cloud/). Required when loadScript is true',\n )\n .optional(),\n disableCookies: z\n .boolean()\n .default(false)\n .describe('Disable all tracking cookies for cookie-free analytics'),\n enableLinkTracking: z\n .boolean()\n .default(true)\n .describe('Enable automatic outlink and download tracking'),\n enableHeartBeatTimer: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Enable heart beat timer with interval in seconds for accurate time-on-page',\n ),\n customDimensions: CustomDimensionsSchema.describe(\n 'Custom dimensions applied to every hit, keyed by bare dimension id (like { \"1\": \"data.userType\" }). Each value is resolved per event. Rule-level customDimensions win per key.',\n ).optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { schemas, z } from '@walkeros/core/dev';\nimport { CustomDimensionsSchema } from './settings';\n\nexport const MappingSchema = z.object({\n goalId: z\n .union([\n z.string().regex(/^[1-9]\\d*$/, 'Goal IDs are positive integers like \"1\"'),\n z.number().int().positive(),\n ])\n .optional()\n .describe(\n 'Matomo goal ID, a positive integer like 1. Adds a trackGoal conversion alongside this event',\n ),\n goalValue: schemas.ValueSchema.describe(\n 'Goal revenue, resolved from the event (like \"data.revenue\"), passed as the trackGoal revenue',\n ).optional(),\n siteSearch: z\n .boolean()\n .optional()\n .describe('Track as internal site search using trackSiteSearch'),\n contentImpression: z\n .boolean()\n .optional()\n .describe('Track as content impression using trackContentImpression'),\n contentInteraction: z\n .boolean()\n .optional()\n .describe('Track as content interaction using trackContentInteraction'),\n customDimensions: CustomDimensionsSchema.describe(\n 'Custom dimensions for this rule, keyed by bare dimension id (like { \"3\": \"data.category\" }). Set just before the hit and removed after it; wins per key over the destination customDimensions.',\n ).optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Matomo destination.\n * Mocks the _paq command queue and DOM elements for testing\n * without requiring real browser or network.\n */\n\nexport const init: Env | undefined = {\n window: {\n // _paq absent: init() is expected to install the queue.\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [],\n location: { href: 'https://www.example.com/page' },\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\n/**\n * Simulation tracking paths.\n * Specifies which function calls to track during simulation.\n */\nexport const simulation = [\n 'call:window._paq.push', // Track _paq.push calls\n];\n","import type { Flow } from '@walkeros/core';\nimport type { Settings } from '../types';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n * Not public: Matomo records an order's products only after an\n * addEcommerceItem call per product, which one rule cannot send, so this\n * shows mapping mechanics only.\n */\nexport const ecommerceOrder: StepExample = {\n public: false,\n title: 'Ecommerce order',\n description:\n \"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.\",\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- nested products and the cart total in one call.\n * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an\n * addEcommerceItem call per product, which one rule cannot send.\n */\nexport const ecommerceCartUpdate: StepExample = {\n public: false,\n title: 'Cart update',\n description:\n 'Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view with a single product array.\n * Not public: Matomo has no ecommerceProductDetailView; it tracks a product\n * view with setEcommerceView followed by trackPageView, two commands.\n */\nexport const productDetailView: StepExample = {\n public: false,\n title: 'Product detail view',\n description:\n 'Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: getEvent('search submit', {\n timestamp: 1700000405,\n data: { query: 'shoes', category: 'products', resultsCount: 42 },\n }),\n mapping: {\n name: 'trackSiteSearch',\n settings: {\n siteSearch: true,\n },\n data: {\n set: ['data.query', 'data.category', 'data.resultsCount'],\n },\n },\n out: [['_paq.push', ['trackSiteSearch', 'shoes', 'products', 42]]],\n};\n\n/**\n * Goal tracking alongside a tracked event.\n * Uses a known fixture event (promotion visible) so data paths resolve.\n */\nexport const goalTracking: StepExample = {\n title: 'Goal with value',\n description:\n 'A promotion event fires Matomo trackEvent and then trackGoal with a monetary goal value from event data.',\n in: getEvent('promotion visible', {\n timestamp: 1700000406,\n data: { name: 'Setting up tracking easily', position: 'hero', value: 50 },\n }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n goalValue: 'data.value',\n },\n data: {\n set: ['data.name'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily']],\n ['_paq.push', ['trackGoal', '1', 50]],\n ],\n};\n\n/**\n * Destination and rule custom dimensions, resolved per event. The destination\n * dimensions come from `settings`, which the docs do not show, so this\n * example stays out of them.\n */\nexport const customDimensions: StepExample = {\n title: 'Custom dimensions',\n description:\n 'Destination and rule custom dimensions are set right before the page view; afterwards the rule-only dimension is deleted and the destination value is set again.',\n public: false,\n in: getEvent('page view', { timestamp: 1700000408 }),\n settings: {\n customDimensions: { '1': 'globals.pagegroup' },\n },\n mapping: {\n settings: {\n customDimensions: { '2': 'data.id' },\n },\n },\n out: [\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ['_paq.push', ['setCustomDimension', 2, '/docs/']],\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['deleteCustomDimension', 2]],\n ['_paq.push', ['setCustomDimension', 1, 'docs']],\n ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS,SAAS;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,EAAE;AAAA,EACtC,EAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,EACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,EACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,EACnB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,kBAAkB,uBAAuB;AAAA,IACvC;AAAA,EACF,EAAE,SAAS;AACb,CAAC;;;AC3CD,SAAS,WAAAA,UAAS,KAAAC,UAAS;AAGpB,IAAM,gBAAgBC,GAAE,OAAO;AAAA,EACp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mBAAgC;AAAA,EAC3C,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAQ;AAAA,EACR,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,UAAU;AAAA,IACR,kBAAkB,EAAE,KAAK,oBAAoB;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,kBAAkB,EAAE,KAAK,UAAU;AAAA,IACrC;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,IAC/C,CAAC,aAAa,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AAAA,IACjD,CAAC,aAAa,CAAC,iBAAiB,wBAAwB,CAAC;AAAA,IACzD,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAAA,IAC1C,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,EACjD;AACF;","names":["schemas","z","z","schemas","init"]}
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { schemas, z } from '@walkeros/core/dev';\n\nconst { ValueSchema } = schemas;\n\nexport const CustomDimensionsSchema = z.record(\n z.string().regex(/^\\d+$/, 'Dimension keys are bare numeric ids like \"1\"'),\n ValueSchema,\n);\n\nexport const SettingsSchema = z\n .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 .strict();\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 for testing without requiring real browser\n * 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};\n\nexport const push: Env = {\n window: {\n _paq: [],\n location: { href: 'https://www.example.com/page' },\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 { createEvent, getEvent } from '@walkeros/core';\n\n/**\n * Matomo step example. The test runner registers the destination with the\n * init example's config and merges an example's optional `settings` on top.\n */\nexport type StepExample = Flow.StepExample & {\n /** Destination settings merged over the init example's settings. */\n settings?: Settings;\n};\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Matomo script and configures\n * the tracker URL, site ID, and link tracking. Reproduce by passing the same\n * settings to `startFlow` as the destination config.\n */\nexport const init: StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.',\n in: {\n loadScript: true,\n settings: {\n siteId: '1',\n url: 'https://analytics.example.com/',\n },\n },\n out: [\n [\n '_paq.push',\n ['setTrackerUrl', 'https://analytics.example.com/matomo.php'],\n ],\n ['_paq.push', ['setSiteId', '1']],\n ['_paq.push', ['enableLinkTracking']],\n ],\n};\n\n/**\n * Default page view -- no mapping name needed.\n * Destination auto-calls trackPageView with the page title.\n */\nexport const pageView: StepExample = {\n title: 'Page view',\n description:\n 'A page view is tracked in Matomo via trackPageView with the page title from event data.',\n in: getEvent('page view', { timestamp: 1700000400 }),\n mapping: {\n data: 'data.title',\n },\n out: [['_paq.push', ['trackPageView', 'walkerOS documentation']]],\n};\n\n/**\n * Page view rule with a goal -- the default trackPageView stays and the goal\n * follows it.\n */\nexport const pageViewWithGoal: StepExample = {\n title: 'Page view with goal',\n description:\n 'A page view rule with a goal keeps the default trackPageView and adds a trackGoal conversion.',\n in: getEvent('page view', { timestamp: 1700000407 }),\n mapping: {\n settings: {\n goalId: '1',\n },\n },\n out: [\n ['_paq.push', ['trackPageView', 'walkerOS documentation']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Custom event tracking with goal conversion.\n * Uses trackEvent with mapped name, followed by trackGoal.\n */\nexport const customEvent: StepExample = {\n title: 'Custom event with goal',\n description:\n 'A promotion visible event fires Matomo trackEvent and then trackGoal to record a goal conversion.',\n in: getEvent('promotion visible', { timestamp: 1700000401 }),\n mapping: {\n name: 'trackEvent',\n settings: {\n goalId: '1',\n },\n data: {\n set: ['data.name', 'data.position'],\n },\n },\n out: [\n ['_paq.push', ['trackEvent', 'Setting up tracking easily', 'hero']],\n ['_paq.push', ['trackGoal', '1', undefined]],\n ],\n};\n\n/**\n * Ecommerce order -- one call with cart items array and order totals.\n * Not public: Matomo records an order's products only after an\n * addEcommerceItem call per product, which one rule cannot send, so this\n * shows mapping mechanics only.\n */\nexport const ecommerceOrder: StepExample = {\n public: false,\n title: 'Ecommerce order',\n description:\n \"Test fixture for nested product mapping, not a valid Matomo call: Matomo records an order's products only after an addEcommerceItem call per product.\",\n in: getEvent('order complete', { timestamp: 1700000402 }),\n mapping: {\n name: 'trackEcommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.value',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceOrder',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n {\n sku: 'cc',\n name: 'Cool Cap',\n category: '',\n price: 42,\n quantity: 1,\n },\n ],\n {\n orderId: '0rd3r1d',\n grandTotal: 555,\n tax: 73.76,\n shipping: 5.22,\n },\n ],\n ],\n ],\n};\n\n/**\n * Ecommerce cart update -- nested products and the cart total in one call.\n * Not public: Matomo takes trackEcommerceCartUpdate(grandTotal) after an\n * addEcommerceItem call per product, which one rule cannot send.\n */\nexport const ecommerceCartUpdate: StepExample = {\n public: false,\n title: 'Cart update',\n description:\n 'Test fixture for nested product mapping, not a valid Matomo call: Matomo takes trackEcommerceCartUpdate(grandTotal) after an addEcommerceItem call per product.',\n in: getEvent('cart view', { timestamp: 1700000403 }),\n mapping: {\n name: 'trackEcommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity: unknown) =>\n typeof entity === 'object' &&\n entity !== null &&\n 'entity' in entity &&\n entity.entity === 'product',\n map: {\n sku: 'data.id',\n name: 'data.name',\n category: { value: '' },\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n 'data.value',\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'trackEcommerceCartUpdate',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n category: '',\n price: 420,\n quantity: 1,\n },\n ],\n 840,\n ],\n ],\n ],\n};\n\n/**\n * Product detail view with a single product array.\n * Not public: Matomo has no ecommerceProductDetailView; it tracks a product\n * view with setEcommerceView followed by trackPageView, two commands.\n */\nexport const productDetailView: StepExample = {\n public: false,\n title: 'Product detail view',\n description:\n 'Test fixture for a single-product mapping, not a valid Matomo call: Matomo tracks a product view with setEcommerceView followed by trackPageView.',\n in: getEvent('product view', { timestamp: 1700000404 }),\n mapping: {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n },\n },\n ],\n },\n ],\n },\n },\n out: [\n [\n '_paq.push',\n [\n 'ecommerceProductDetailView',\n [\n {\n sku: 'ers',\n name: 'Everyday Ruck Snack',\n price: 420,\n quantity: 1,\n },\n ],\n ],\n ],\n ],\n};\n\n/**\n * Site search -- trackSiteSearch with keyword, category, result count.\n */\nexport const siteSearch: StepExample = {\n title: 'Site search',\n description:\n 'A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.',\n in: createEvent({\n name: '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\n/** A silent rule without a goal sends nothing. */\nexport const silentRule: StepExample = {\n public: false,\n description:\n 'A rule with silent: true and no goal sends no command, its dimensions included.',\n in: getEvent('page view', { timestamp: 1700000300 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * An event no rule maps: Matomo has no command for it, so the push fails\n * instead of counting as delivered.\n */\nexport const unmappedEvent: StepExample = {\n public: false,\n description:\n 'An event without a rule name, a tracking flag or a goal, and not a page view, has no Matomo command: the push fails with missing-input.',\n in: getEvent('product view', { timestamp: 1700000301 }),\n out: [],\n outcome: { status: 'failed', code: 'missing-input', retryable: false },\n};\n\n/**\n * A revocation of the consent the destination requires stops Matomo:\n * config.consent { marketing: true }, granted first, then revoked.\n */\nexport const consentRevoke: StepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing pushes forgetConsentGiven, which stops every tracking request of the page, link tracking included.',\n command: 'consent',\n in: { marketing: false },\n out: [['window._paq.push', ['forgetConsentGiven']]],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS,SAAS;AAE3B,IAAM,EAAE,YAAY,IAAI;AAEjB,IAAM,yBAAyB,EAAE;AAAA,EACtC,EAAE,OAAO,EAAE,MAAM,SAAS,8CAA8C;AAAA,EACxE;AACF;AAEO,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,EACb,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,wDAAwD;AAAA,EACpE,oBAAoB,EACjB,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,gDAAgD;AAAA,EAC5D,sBAAsB,EACnB,OAAO,EACP,IAAI,EACJ,SAAS,EAC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AAAA,IACR,kBAAkB,EAAE,KAAK,oBAAoB;AAAA,EAC/C;AAAA,EACA,SAAS;AAAA,IACP,UAAU;AAAA,MACR,kBAAkB,EAAE,KAAK,UAAU;AAAA,IACrC;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,IAC/C,CAAC,aAAa,CAAC,sBAAsB,GAAG,QAAQ,CAAC;AAAA,IACjD,CAAC,aAAa,CAAC,iBAAiB,wBAAwB,CAAC;AAAA,IACzD,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAAA,IAC1C,CAAC,aAAa,CAAC,sBAAsB,GAAG,MAAM,CAAC;AAAA,EACjD;AACF;AAGO,IAAM,aAA0B;AAAA,EACrC,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAMO,IAAM,gBAA6B;AAAA,EACxC,QAAQ;AAAA,EACR,aACE;AAAA,EACF,IAAI,SAAS,gBAAgB,EAAE,WAAW,WAAW,CAAC;AAAA,EACtD,KAAK,CAAC;AAAA,EACN,SAAS,EAAE,QAAQ,UAAU,MAAM,iBAAiB,WAAW,MAAM;AACvE;AAMO,IAAM,gBAA6B;AAAA,EACxC,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;AACpD;","names":["schemas","z","z","schemas","init"]}
|
|
@@ -29,23 +29,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
29
29
|
href?: string;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
document: {
|
|
33
|
-
createElement: (tagName: string) => {
|
|
34
|
-
type: string;
|
|
35
|
-
src: string;
|
|
36
|
-
async?: boolean;
|
|
37
|
-
defer?: boolean;
|
|
38
|
-
};
|
|
39
|
-
head: {
|
|
40
|
-
appendChild: (node: unknown) => void;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
32
|
}
|
|
44
33
|
|
|
45
34
|
/**
|
|
46
35
|
* Example environment configurations for Matomo destination.
|
|
47
|
-
* Mocks the _paq command queue
|
|
48
|
-
*
|
|
36
|
+
* Mocks the _paq command queue for testing without requiring real browser
|
|
37
|
+
* or network.
|
|
49
38
|
*/
|
|
50
39
|
declare const init$1: Env | undefined;
|
|
51
40
|
declare const push: Env;
|
|
@@ -125,8 +114,21 @@ declare const goalTracking: StepExample;
|
|
|
125
114
|
* example stays out of them.
|
|
126
115
|
*/
|
|
127
116
|
declare const customDimensions: StepExample;
|
|
117
|
+
/** A silent rule without a goal sends nothing. */
|
|
118
|
+
declare const silentRule: StepExample;
|
|
119
|
+
/**
|
|
120
|
+
* An event no rule maps: Matomo has no command for it, so the push fails
|
|
121
|
+
* instead of counting as delivered.
|
|
122
|
+
*/
|
|
123
|
+
declare const unmappedEvent: StepExample;
|
|
124
|
+
/**
|
|
125
|
+
* A revocation of the consent the destination requires stops Matomo:
|
|
126
|
+
* config.consent { marketing: true }, granted first, then revoked.
|
|
127
|
+
*/
|
|
128
|
+
declare const consentRevoke: StepExample;
|
|
128
129
|
|
|
129
130
|
type step_StepExample = StepExample;
|
|
131
|
+
declare const step_consentRevoke: typeof consentRevoke;
|
|
130
132
|
declare const step_customDimensions: typeof customDimensions;
|
|
131
133
|
declare const step_customEvent: typeof customEvent;
|
|
132
134
|
declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
|
|
@@ -136,9 +138,11 @@ declare const step_init: typeof init;
|
|
|
136
138
|
declare const step_pageView: typeof pageView;
|
|
137
139
|
declare const step_pageViewWithGoal: typeof pageViewWithGoal;
|
|
138
140
|
declare const step_productDetailView: typeof productDetailView;
|
|
141
|
+
declare const step_silentRule: typeof silentRule;
|
|
139
142
|
declare const step_siteSearch: typeof siteSearch;
|
|
143
|
+
declare const step_unmappedEvent: typeof unmappedEvent;
|
|
140
144
|
declare namespace step {
|
|
141
|
-
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 };
|
|
145
|
+
export { type step_StepExample as StepExample, step_consentRevoke as consentRevoke, 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_silentRule as silentRule, step_siteSearch as siteSearch, step_unmappedEvent as unmappedEvent };
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
export { env, step };
|