@ogcio/analytics-sdk 0.0.1-beta.1 → 0.0.1-beta.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.
Files changed (50) hide show
  1. package/dist/index.d.ts +547 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +86 -9
  4. package/dist/matomo/helpers.d.ts +8 -0
  5. package/dist/matomo/helpers.d.ts.map +1 -1
  6. package/dist/matomo/helpers.js +79 -0
  7. package/dist/matomo/types.d.ts +5 -2
  8. package/dist/matomo/types.d.ts.map +1 -1
  9. package/dist/schema.d.ts +209 -13
  10. package/dist/schema.d.ts.map +1 -1
  11. package/package.json +8 -8
  12. package/src/index.ts +109 -15
  13. package/src/matomo/helpers.ts +101 -0
  14. package/src/matomo/types.ts +18 -2
  15. package/src/schema.ts +209 -13
  16. package/test-report.xml +181 -0
  17. package/dist/ogcio-analytics-sdk-0.0.1.tgz +0 -0
  18. package/dist/package/dist/base/base-client.d.ts +0 -36
  19. package/dist/package/dist/base/base-client.d.ts.map +0 -1
  20. package/dist/package/dist/base/base-client.js +0 -96
  21. package/dist/package/dist/index.d.ts +0 -651
  22. package/dist/package/dist/index.d.ts.map +0 -1
  23. package/dist/package/dist/index.js +0 -321
  24. package/dist/package/dist/matomo/helpers.d.ts +0 -9
  25. package/dist/package/dist/matomo/helpers.d.ts.map +0 -1
  26. package/dist/package/dist/matomo/helpers.js +0 -10
  27. package/dist/package/dist/matomo/types.d.ts +0 -33
  28. package/dist/package/dist/matomo/types.d.ts.map +0 -1
  29. package/dist/package/dist/matomo/types.js +0 -1
  30. package/dist/package/dist/schema.d.ts +0 -1295
  31. package/dist/package/dist/schema.d.ts.map +0 -1
  32. package/dist/package/dist/schema.js +0 -5
  33. package/dist/package/dist/support-files/auth/index.d.ts +0 -3
  34. package/dist/package/dist/support-files/auth/index.d.ts.map +0 -1
  35. package/dist/package/dist/support-files/auth/index.js +0 -76
  36. package/dist/package/dist/support-files/auth/types.d.ts +0 -31
  37. package/dist/package/dist/support-files/auth/types.d.ts.map +0 -1
  38. package/dist/package/dist/support-files/auth/types.js +0 -1
  39. package/dist/package/dist/support-files/building-blocks-sdk.d.ts +0 -17
  40. package/dist/package/dist/support-files/building-blocks-sdk.d.ts.map +0 -1
  41. package/dist/package/dist/support-files/building-blocks-sdk.js +0 -11
  42. package/dist/package/dist/utils/index.d.ts +0 -7
  43. package/dist/package/dist/utils/index.d.ts.map +0 -1
  44. package/dist/package/dist/utils/index.js +0 -19
  45. package/dist/package/examples/environment.d.ts +0 -11
  46. package/dist/package/examples/index.ts +0 -201
  47. package/dist/package/examples/tsconfig.json +0 -15
  48. package/dist/package/package.json +0 -56
  49. package/dist/package/tsconfig.json +0 -18
  50. package/dist/package/types.d.ts +0 -19
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,cAAc,+BAA+B,CAAC;AAI9C,OAAO,UAAU,EAAE,EAEjB,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;AAkB/B,MAAM,MAAM,cAAc,GAAG;KAC1B,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC,SAAS,+BAA+B,MAAM,EAAE,GACjE,CAAC,GACD,KAAK;CACV,CAAC,MAAM,KAAK,CAAC,CAAC;AAEf,KAAK,gBAAgB,GAAG,mBAAmB,GAAG;IAC5C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAG3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAKF,qBAAa,SAAU,SAAQ,UAAU,CAAC,KAAK,CAAC;IAC9C,UAAkB,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,SAAS,C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;;;;;;;;;;;;;;;;;;;;;IAS/G,uBAAuB,CAC3B,IAAI,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqBhH,mCAAmC,CACvC,IAAI,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQvH"}
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { isBrowser } from "./utils/index.js";
8
- import { getTracker, push } from "./matomo/helpers.js";
8
+ import { getTracker, initMatomoArray, initTracker, push, } from "./matomo/helpers.js";
9
9
  export * from "./support-files/auth/index.js";
10
10
  // Since Analytics is a client of the Building-Blocks-SDK, we need to temporarily copy and import the base client from the Building-Blocks-SDK
11
11
  // in the future, we should move the base client to a base-building-blocks package, in order to avoid circular dependencies and copy-pasting code
@@ -29,6 +29,9 @@ export class Analytics extends BaseClient {
29
29
  if (trackingWebsiteId) {
30
30
  this.setTrackingWebsiteId(trackingWebsiteId);
31
31
  }
32
+ if (isBrowser()) {
33
+ initMatomoArray();
34
+ }
32
35
  }
33
36
  async retrieveWebsiteConfiguration(websiteId) {
34
37
  if (!this.organizationId) {
@@ -60,8 +63,14 @@ export class Analytics extends BaseClient {
60
63
  console.warn("Opt out is enabled, skipping request");
61
64
  return { data: undefined, error: undefined };
62
65
  }
63
- const result = await promise;
64
- return { data: result.data, error: result.error };
66
+ try {
67
+ const result = await promise;
68
+ return { data: result.data, error: result.error };
69
+ }
70
+ catch (error) {
71
+ console.error("Error tracking event", error);
72
+ return { error, data: undefined };
73
+ }
65
74
  };
66
75
  /*
67
76
  * Set the tracking website ID and retrieve the website configuration.
@@ -121,6 +130,21 @@ export class Analytics extends BaseClient {
121
130
  throw new Error("Website configuration cannot be retrieved");
122
131
  }
123
132
  }
133
+ /*
134
+ * Initialize the client-side tracker.
135
+ * This method is used to initialize the Matomo tracker on the client-side, appending a script tag to the head of the document.
136
+ *
137
+ * @param overrideConfig - Optional configuration to override the default website configuration, you can also pass a user_id to set the Matomo user ID.
138
+ * @example
139
+ * await analytics.initClientTracker({ user_id: "123" });
140
+ */
141
+ async initClientTracker(overrideConfig) {
142
+ await this.ensureWebsiteConfiguration();
143
+ initTracker({
144
+ websiteConfiguration: this.websiteConfiguration,
145
+ overrideConfig,
146
+ });
147
+ }
124
148
  async trackPush(eventName, eventArguments, siteIds) {
125
149
  await this.ensureWebsiteConfiguration();
126
150
  if (this.isDryRun) {
@@ -272,21 +296,68 @@ export class Analytics extends BaseClient {
272
296
  generateCode: true,
273
297
  });
274
298
  }
275
- async trackOutLink(data) {
299
+ async trackLink(data) {
276
300
  if (!isBrowser()) {
277
301
  return this.trackBackendAction({
278
- url: "/api/v1/websites/{id}/track-out-link",
302
+ url: "/api/v1/websites/{id}/track-link",
279
303
  data,
280
304
  generateCode: false,
281
305
  });
282
306
  }
283
307
  const { event, site_ids } = data;
284
- const eventArguments = [event.link];
308
+ const eventArguments = [event.link, event.linkType];
285
309
  return this.trackPush("trackLink", eventArguments, site_ids);
286
310
  }
287
- async generateTrackOutLinkCode(data) {
311
+ async generateTrackLinkCode(data) {
288
312
  return this.trackBackendAction({
289
- url: "/api/v1/websites/{id}/track-out-link",
313
+ url: "/api/v1/websites/{id}/track-link",
314
+ data,
315
+ generateCode: true,
316
+ });
317
+ }
318
+ async trackContentImpression(data) {
319
+ if (!isBrowser()) {
320
+ return this.trackBackendAction({
321
+ url: "/api/v1/websites/{id}/track-content-impression",
322
+ data,
323
+ generateCode: false,
324
+ });
325
+ }
326
+ const { event, site_ids } = data;
327
+ const eventArguments = [
328
+ event.content_name,
329
+ event.content_piece,
330
+ event.content_target,
331
+ ];
332
+ return this.trackPush("trackContentImpression", eventArguments, site_ids);
333
+ }
334
+ async generateTrackContentImpressionCode(data) {
335
+ return this.trackBackendAction({
336
+ url: "/api/v1/websites/{id}/track-content-impression",
337
+ data,
338
+ generateCode: true,
339
+ });
340
+ }
341
+ async trackContentInteraction(data) {
342
+ if (!isBrowser()) {
343
+ return this.trackBackendAction({
344
+ url: "/api/v1/websites/{id}/track-content-interaction",
345
+ data,
346
+ generateCode: false,
347
+ });
348
+ }
349
+ const { event, site_ids } = data;
350
+ const eventArguments = [
351
+ event.content_interaction,
352
+ event.content_name,
353
+ event.content_piece,
354
+ event.content_target,
355
+ ];
356
+ return this.trackPush("trackContentInteraction", eventArguments, site_ids);
357
+ }
358
+ async generateTrackContentInteractionCode(data) {
359
+ return this.trackBackendAction({
360
+ url: "/api/v1/websites/{id}/track-content-interaction",
290
361
  data,
291
362
  generateCode: true,
292
363
  });
@@ -318,4 +389,10 @@ __decorate([
318
389
  ], Analytics.prototype, "generateTrackSiteSearchCode", null);
319
390
  __decorate([
320
391
  needsBackend
321
- ], Analytics.prototype, "generateTrackOutLinkCode", null);
392
+ ], Analytics.prototype, "generateTrackLinkCode", null);
393
+ __decorate([
394
+ needsBackend
395
+ ], Analytics.prototype, "generateTrackContentImpressionCode", null);
396
+ __decorate([
397
+ needsBackend
398
+ ], Analytics.prototype, "generateTrackContentInteractionCode", null);
@@ -1,3 +1,4 @@
1
+ import { WebsiteConfiguration, WebsiteTrackingCode } from "../index.js";
1
2
  import type { PushQueueItem } from "./types.js";
2
3
  export declare function push(collection: PushQueueItem): number;
3
4
  export declare function getTracker(trackerUrl: string, siteId: string): {
@@ -5,5 +6,12 @@ export declare function getTracker(trackerUrl: string, siteId: string): {
5
6
  trackEvent: (...eventArguments: (string | number)[]) => void;
6
7
  trackPageView: (...eventArguments: (string | number)[]) => void;
7
8
  trackLink: (...eventArguments: (string | number)[]) => void;
9
+ trackContentImpression: (...eventArguments: (string | number)[]) => void;
10
+ trackContentInteraction: (...eventArguments: (string | number)[]) => void;
8
11
  };
12
+ export declare function initMatomoArray(): void;
13
+ export declare function initTracker({ websiteConfiguration, overrideConfig, }: {
14
+ websiteConfiguration: WebsiteConfiguration;
15
+ overrideConfig?: Partial<WebsiteTrackingCode>;
16
+ }): void;
9
17
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/matomo/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,IAAI,CAAC,UAAU,EAAE,aAAa,UAO7C;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;EAE5D"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/matomo/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAUhD,wBAAgB,IAAI,CAAC,UAAU,EAAE,aAAa,UAO7C;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;EAE5D;AAED,wBAAgB,eAAe,SAE9B;AAED,wBAAgB,WAAW,CAAC,EAC1B,oBAAoB,EACpB,cAAc,GACf,EAAE;IACD,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,cAAc,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC/C,QAgFA"}
@@ -1,3 +1,10 @@
1
+ const MatomoConstants = {
2
+ DimensionPrefix: "dimension",
3
+ Tracker: "/matomo.php",
4
+ TrackerBypass: "/tr4ck3rp",
5
+ TrackerScript: "/matomo.js",
6
+ TrackerScriptBypass: "/tr4ck3rj",
7
+ };
1
8
  export function push(collection) {
2
9
  if (!window._paq)
3
10
  window._paq = [];
@@ -8,3 +15,75 @@ export function push(collection) {
8
15
  export function getTracker(trackerUrl, siteId) {
9
16
  return window.Matomo.getTracker(trackerUrl, siteId);
10
17
  }
18
+ export function initMatomoArray() {
19
+ if (!window._paq)
20
+ window._paq = [];
21
+ }
22
+ export function initTracker({ websiteConfiguration, overrideConfig, }) {
23
+ const config = {
24
+ ...websiteConfiguration,
25
+ ...overrideConfig,
26
+ };
27
+ const [mainSiteId, ...otherSiteIds] = config.site_ids;
28
+ const trackerUrl = config.bypass_adblockers
29
+ ? config.tracker_url + MatomoConstants.TrackerBypass
30
+ : config.tracker_url + MatomoConstants.Tracker;
31
+ // Add custom dimensions
32
+ if (config.custom_dimensions) {
33
+ for (const [key, value] of Object.entries(config.custom_dimensions)) {
34
+ window._paq.push([
35
+ "setCustomDimension",
36
+ parseInt(key.replace(MatomoConstants.DimensionPrefix, "")),
37
+ value,
38
+ ]);
39
+ }
40
+ }
41
+ // Set user ID if provided
42
+ if (config?.user_id) {
43
+ window._paq.push(["setUserId", config.user_id]);
44
+ }
45
+ // Configure tracking options
46
+ if (config.link_tracking) {
47
+ window._paq.push(["enableLinkTracking"]);
48
+ }
49
+ if (config.cookieless) {
50
+ window._paq.push(["disableCookies"]);
51
+ }
52
+ if (config.tracker_url) {
53
+ window._paq.push(["setTrackerUrl", trackerUrl]);
54
+ }
55
+ if (config.track_bots) {
56
+ window._paq.push(["appendToTrackingUrl", "bot=1"]);
57
+ }
58
+ if (mainSiteId) {
59
+ window._paq.push(["setSiteId", mainSiteId]);
60
+ }
61
+ // Add additional trackers for other site IDs
62
+ if (otherSiteIds.length > 0) {
63
+ for (const siteId of otherSiteIds) {
64
+ window._paq.push(["addTracker", trackerUrl, siteId]);
65
+ }
66
+ }
67
+ // Configure additional features
68
+ if (config.browser_feature_detection) {
69
+ window._paq.push(["disableBrowserFeatureDetection"]);
70
+ }
71
+ if (config.heart_beat_timer != null) {
72
+ const timer = Number(config.heart_beat_timer) || 0;
73
+ window._paq.push(["enableHeartBeatTimer", timer]);
74
+ }
75
+ // Track page view if enabled (should be last)
76
+ if (config.track_page_view) {
77
+ window._paq.push(["trackPageView"]);
78
+ }
79
+ // Load the tracker script
80
+ const scriptUrl = config.bypass_adblockers
81
+ ? config.tracker_url + MatomoConstants.TrackerScriptBypass
82
+ : config.tracker_url + MatomoConstants.TrackerScript;
83
+ const script = document.createElement("script");
84
+ script.type = "text/javascript";
85
+ script.async = true;
86
+ script.src = scriptUrl;
87
+ const firstScript = document.getElementsByTagName("script")[0];
88
+ firstScript.parentNode?.insertBefore(script, firstScript);
89
+ }
@@ -1,11 +1,14 @@
1
+ type InitTrackerMethods = "setUserId" | "enableLinkTracking" | "disableCookies" | "setTrackerUrl" | "appendToTrackingUrl" | "addTracker" | "disableBrowserFeatureDetection" | "enableHeartBeatTimer" | "setSiteId";
1
2
  type SiteSearchTrackEvent = "trackSiteSearch";
2
3
  type CustomEventTrackEvent = "trackEvent";
3
4
  type PageViewsTrackEvent = "trackPageView";
4
5
  type OutlinkTrackEvent = "trackLink";
6
+ type ContentImpressionTrackEvent = "trackContentImpression";
7
+ type ContentInteractionTrackEvent = "trackContentInteraction";
5
8
  type PaqServiceMethods = "setCustomUrl" | "setDocumentTitle";
6
9
  type CustomDimensionsMethods = "setCustomDimensionValue" | "deleteCustomDimension" | "setCustomDimension";
7
- export type TrackEventMethods = SiteSearchTrackEvent | CustomEventTrackEvent | PageViewsTrackEvent | OutlinkTrackEvent;
8
- export type PushQueueMethods = CustomDimensionsMethods | TrackEventMethods | PaqServiceMethods;
10
+ export type TrackEventMethods = SiteSearchTrackEvent | CustomEventTrackEvent | PageViewsTrackEvent | OutlinkTrackEvent | ContentImpressionTrackEvent | ContentInteractionTrackEvent;
11
+ export type PushQueueMethods = CustomDimensionsMethods | TrackEventMethods | PaqServiceMethods | InitTrackerMethods;
9
12
  export type VisitorInfo = [
10
13
  isNew: "0" | "1",
11
14
  visitorId: string,
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/matomo/types.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG,iBAAiB,CAAC;AAC9C,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAC1C,KAAK,mBAAmB,GAAG,eAAe,CAAC;AAC3C,KAAK,iBAAiB,GAAG,WAAW,CAAC;AACrC,KAAK,iBAAiB,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAC7D,KAAK,uBAAuB,GACxB,yBAAyB,GACzB,uBAAuB,GACvB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,iBAAiB,GACzB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,iBAAiB,CAAC;AAEtB,MAAM,MAAM,gBAAgB,GACxB,uBAAuB,GACvB,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,GAAG,GAAG,GAAG;IAChB,SAAS,EAAE,MAAM;IACjB,YAAY,EAAE,MAAM;IACpB,kBAAkB,EAAE,MAAM,GAAG,MAAM;IACnC,cAAc,EAAE,MAAM;IACtB,WAAW,EAAE,MAAM,GAAG,EAAE;IACxB,oBAAoB,EAAE,MAAM,GAAG,EAAE;CAClC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,eAAe,EAAE,MAAM,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,MAAM,CAAC;IACtC,6BAA6B,EAAE,MAAM,MAAM,CAAC;IAC5C,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACrE,oBAAoB,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M;IACpB,kBAAkB,EAAE,MAAM,GAAG,MAAM;IACnC,cAAc,EAAE,MAAM;IACtB,WAAW,EAAE,MAAM,GAAG,EAAE;IACxB,oBAAoB,EAAE,MAAM,GAAG,EAAE;CAClC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,eAAe,EAAE,MAAM,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,MAAM,CAAC;IACtC,6BAA6B,EAAE,MAAM,MAAM,CAAC;IAC5C,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACrE,oBAAoB,EAAE,MAAM,MAAM,CAAC;IACnC,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,WAAW,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB,CAAC,gBAAgB,EAAE,GAAG,OAAO,EAAE,CAAC,GAChC,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC"}
package/dist/schema.d.ts CHANGED
@@ -714,6 +714,8 @@ export interface paths {
714
714
  value?: number;
715
715
  };
716
716
  metadata?: {
717
+ /** @description The URL of the page */
718
+ url?: string;
717
719
  /** @description The user agent of the user */
718
720
  userAgent?: string;
719
721
  /** @description The referrer of the user */
@@ -805,6 +807,8 @@ export interface paths {
805
807
  action_name: string;
806
808
  };
807
809
  metadata?: {
810
+ /** @description The URL of the page */
811
+ url?: string;
808
812
  /** @description The user agent of the user */
809
813
  userAgent?: string;
810
814
  /** @description The referrer of the user */
@@ -900,6 +904,8 @@ export interface paths {
900
904
  search_count?: number;
901
905
  };
902
906
  metadata?: {
907
+ /** @description The URL of the page */
908
+ url?: string;
903
909
  /** @description The user agent of the user */
904
910
  userAgent?: string;
905
911
  /** @description The referrer of the user */
@@ -958,7 +964,7 @@ export interface paths {
958
964
  patch?: never;
959
965
  trace?: never;
960
966
  };
961
- "/api/v1/websites/{id}/track-out-link": {
967
+ "/api/v1/websites/{id}/track-link": {
962
968
  parameters: {
963
969
  query?: never;
964
970
  header?: never;
@@ -967,7 +973,7 @@ export interface paths {
967
973
  };
968
974
  get?: never;
969
975
  put?: never;
970
- /** @description Track outgoing link */
976
+ /** @description Track link that could be an outgoing link or a download link */
971
977
  post: {
972
978
  parameters: {
973
979
  query?: {
@@ -987,20 +993,210 @@ export interface paths {
987
993
  /** @description Array of site IDs */
988
994
  site_ids?: number[];
989
995
  event: {
990
- /** @description An external URL the user has opened. Used for tracking outlink clicks. */
996
+ /** @description The type of the link - either 'link' for outgoing links or 'download' for downloads */
997
+ linkType: "link" | "download";
998
+ /** @description The URL of the link */
991
999
  link: string;
992
- /**
993
- * @description Custom dimensions example: { 'dimension1': 'value1', 'dimension2': 'value2' }
994
- * @example {
995
- * "dimension1": "value1",
996
- * "dimension2": "value2"
997
- * }
998
- */
999
- dimensions?: {
1000
- [key: string]: string;
1001
- };
1002
1000
  };
1003
1001
  metadata?: {
1002
+ /** @description The URL of the page */
1003
+ url?: string;
1004
+ /** @description The user agent of the user */
1005
+ userAgent?: string;
1006
+ /** @description The referrer of the user */
1007
+ referrer?: string;
1008
+ /** @description The language of the user */
1009
+ language?: string;
1010
+ /** @description The resolution of the device */
1011
+ screenResolution?: string;
1012
+ /** @description The user ID of the user, User ID is any non-empty unique string identifying the user (such as an email address or a username). */
1013
+ userId?: string;
1014
+ };
1015
+ };
1016
+ };
1017
+ };
1018
+ responses: {
1019
+ /** @description Default Response */
1020
+ 200: {
1021
+ headers: {
1022
+ [name: string]: unknown;
1023
+ };
1024
+ content: {
1025
+ "application/json": {
1026
+ data: unknown;
1027
+ };
1028
+ };
1029
+ };
1030
+ /** @description Default Response */
1031
+ 500: {
1032
+ headers: {
1033
+ [name: string]: unknown;
1034
+ };
1035
+ content: {
1036
+ "application/json": {
1037
+ /** @description Code used to categorize the error */
1038
+ code: string;
1039
+ /** @description Description of the error */
1040
+ detail: string;
1041
+ /** @description Unique request id. This one will be used to troubleshoot the problems */
1042
+ requestId: string;
1043
+ /** @description Name of the error type */
1044
+ name: string;
1045
+ /** @description List of the validation errors */
1046
+ validation?: {
1047
+ fieldName: string;
1048
+ message: string;
1049
+ }[];
1050
+ validationContext?: string;
1051
+ };
1052
+ };
1053
+ };
1054
+ };
1055
+ };
1056
+ delete?: never;
1057
+ options?: never;
1058
+ head?: never;
1059
+ patch?: never;
1060
+ trace?: never;
1061
+ };
1062
+ "/api/v1/websites/{id}/track-content-impression": {
1063
+ parameters: {
1064
+ query?: never;
1065
+ header?: never;
1066
+ path?: never;
1067
+ cookie?: never;
1068
+ };
1069
+ get?: never;
1070
+ put?: never;
1071
+ /** @description Track content impression for a website */
1072
+ post: {
1073
+ parameters: {
1074
+ query?: {
1075
+ /** @description If true, use code-based tracking */
1076
+ code?: boolean;
1077
+ };
1078
+ header?: never;
1079
+ path: {
1080
+ /** @description Website UUID */
1081
+ id: string;
1082
+ };
1083
+ cookie?: never;
1084
+ };
1085
+ requestBody: {
1086
+ content: {
1087
+ "application/json": {
1088
+ /** @description Array of site IDs */
1089
+ site_ids?: number[];
1090
+ event: {
1091
+ /** @description The name of the content block */
1092
+ content_name: string;
1093
+ /** @description The piece of the content that was displayed (e.g. link to an image) */
1094
+ content_piece: string;
1095
+ /** @description The target of the content leads to (e.g. URL of some external website) */
1096
+ content_target: string;
1097
+ };
1098
+ metadata?: {
1099
+ /** @description The URL of the page */
1100
+ url?: string;
1101
+ /** @description The user agent of the user */
1102
+ userAgent?: string;
1103
+ /** @description The referrer of the user */
1104
+ referrer?: string;
1105
+ /** @description The language of the user */
1106
+ language?: string;
1107
+ /** @description The resolution of the device */
1108
+ screenResolution?: string;
1109
+ /** @description The user ID of the user, User ID is any non-empty unique string identifying the user (such as an email address or a username). */
1110
+ userId?: string;
1111
+ };
1112
+ };
1113
+ };
1114
+ };
1115
+ responses: {
1116
+ /** @description Default Response */
1117
+ 200: {
1118
+ headers: {
1119
+ [name: string]: unknown;
1120
+ };
1121
+ content: {
1122
+ "application/json": {
1123
+ data: unknown;
1124
+ };
1125
+ };
1126
+ };
1127
+ /** @description Default Response */
1128
+ 500: {
1129
+ headers: {
1130
+ [name: string]: unknown;
1131
+ };
1132
+ content: {
1133
+ "application/json": {
1134
+ /** @description Code used to categorize the error */
1135
+ code: string;
1136
+ /** @description Description of the error */
1137
+ detail: string;
1138
+ /** @description Unique request id. This one will be used to troubleshoot the problems */
1139
+ requestId: string;
1140
+ /** @description Name of the error type */
1141
+ name: string;
1142
+ /** @description List of the validation errors */
1143
+ validation?: {
1144
+ fieldName: string;
1145
+ message: string;
1146
+ }[];
1147
+ validationContext?: string;
1148
+ };
1149
+ };
1150
+ };
1151
+ };
1152
+ };
1153
+ delete?: never;
1154
+ options?: never;
1155
+ head?: never;
1156
+ patch?: never;
1157
+ trace?: never;
1158
+ };
1159
+ "/api/v1/websites/{id}/track-content-interaction": {
1160
+ parameters: {
1161
+ query?: never;
1162
+ header?: never;
1163
+ path?: never;
1164
+ cookie?: never;
1165
+ };
1166
+ get?: never;
1167
+ put?: never;
1168
+ /** @description Track content interaction for a website */
1169
+ post: {
1170
+ parameters: {
1171
+ query?: {
1172
+ /** @description If true, use code-based tracking */
1173
+ code?: boolean;
1174
+ };
1175
+ header?: never;
1176
+ path: {
1177
+ /** @description Website UUID */
1178
+ id: string;
1179
+ };
1180
+ cookie?: never;
1181
+ };
1182
+ requestBody: {
1183
+ content: {
1184
+ "application/json": {
1185
+ /** @description Array of site IDs */
1186
+ site_ids?: number[];
1187
+ event: {
1188
+ /** @description The name of the content block */
1189
+ content_name: string;
1190
+ /** @description The piece of the content that was displayed (e.g. link to an image) */
1191
+ content_piece: string;
1192
+ /** @description The target of the content leads to (e.g. URL of some external website) */
1193
+ content_target: string;
1194
+ /** @description The interaction of the content, example: 'click' */
1195
+ content_interaction: string;
1196
+ };
1197
+ metadata?: {
1198
+ /** @description The URL of the page */
1199
+ url?: string;
1004
1200
  /** @description The user agent of the user */
1005
1201
  userAgent?: string;
1006
1202
  /** @description The referrer of the user */