saasco-sdk 0.1.29 → 0.1.30

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/index.cjs.js CHANGED
@@ -7,7 +7,7 @@ var uuid = require('@lukeed/uuid');
7
7
  var psl = require('psl');
8
8
  var zod = require('zod');
9
9
 
10
- var version = "0.1.29";
10
+ var version = "0.1.30";
11
11
 
12
12
  const timezones = {
13
13
  'Asia/Barnaul': 'RU',
@@ -455,6 +455,17 @@ function getBrowserContext() {
455
455
  const $screenWidth = screen.width;
456
456
  const $title = document.title;
457
457
  const $userAgent = window.navigator.userAgent;
458
+ const params = new URLSearchParams(window.location.search);
459
+ const $utmSource = params.get('utm_source');
460
+ const $utmMedium = params.get('utm_medium');
461
+ const $utmCampaign = params.get('utm_campaign');
462
+ const $utmTerm = params.get('utm_term');
463
+ const $utmContent = params.get('utm_content');
464
+ const $utmId = params.get('utm_id');
465
+ const $utmSourcePlatform = params.get('utm_source_platform');
466
+ const $utmCampaignId = params.get('utm_campaign_id');
467
+ const $utmCreativeFormat = params.get('utm_creative_format');
468
+ const $utmMarketingTactic = params.get('utm_marketing_tactic');
458
469
  return {
459
470
  $locale,
460
471
  $location,
@@ -465,55 +476,43 @@ function getBrowserContext() {
465
476
  $screenHeight,
466
477
  $screenWidth,
467
478
  $title,
468
- $userAgent
479
+ $userAgent,
480
+ $utmSource,
481
+ $utmMedium,
482
+ $utmCampaign,
483
+ $utmTerm,
484
+ $utmContent,
485
+ $utmId,
486
+ $utmSourcePlatform,
487
+ $utmCampaignId,
488
+ $utmCreativeFormat,
489
+ $utmMarketingTactic
469
490
  };
470
491
  }
471
492
 
472
- function getUTMContext() {
473
- const isBrowser = typeof window !== 'undefined';
474
- if (!isBrowser) throw new Error('getUTMContext can only be called in browser');
475
- const params = new URLSearchParams(window.location.search);
476
- const $utmSource = params.get('utm_source');
477
- const $utmMedium = params.get('utm_medium');
478
- const $utmCampaign = params.get('utm_campaign');
479
- const $utmTerm = params.get('utm_term');
480
- const $utmContent = params.get('utm_content');
481
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, $utmSource ? {
482
- $utmSource
483
- } : {}), $utmMedium ? {
484
- $utmMedium
485
- } : {}), $utmCampaign ? {
486
- $utmCampaign
487
- } : {}), $utmTerm ? {
488
- $utmTerm
489
- } : {}), $utmContent ? {
490
- $utmContent
491
- } : {});
492
- }
493
-
494
493
  const isBrowser = typeof window !== 'undefined';
495
494
  const isServer = !isBrowser;
496
495
  const PREF = 'saasco-sdk';
497
496
  const SESSION_DURATION = 1000 * 60 * 30;
498
497
  const USER_DURATION = 1000 * 60 * 60 * 24 * 365;
499
498
  const data = {};
500
- function getRootDomain() {
499
+ function getRootDomain(url) {
501
500
  if (isServer) return;
502
- const hostname = window.location.hostname;
503
- if (!psl.isValid(hostname)) {
504
- // If not a valid domain, don't set domain (for localhost, IP addresses, etc.)
505
- return undefined;
506
- }
507
- const parsed = psl.parse(hostname);
508
- if ('domain' in parsed && parsed.domain) {
509
- return parsed.domain;
501
+ if (!url) return;
502
+ try {
503
+ const hostname = new URL(url).hostname;
504
+ if (!psl.isValid(hostname)) return;
505
+ const parsed = psl.parse(hostname);
506
+ if ('domain' in parsed && parsed.domain) return parsed.domain;
507
+ } catch (error) {
508
+ // invalid url
510
509
  }
511
- return undefined;
510
+ return;
512
511
  }
513
512
  function setCookie(name, value, ttl) {
514
513
  if (isServer) return;
515
514
  const expires = new Date(Date.now() + ttl).toUTCString();
516
- const domain = getRootDomain();
515
+ const domain = getRootDomain(window.location.href);
517
516
  const cookieString = `${name}=${encodeURIComponent(value)}; expires=${expires}; path=/${domain ? `; domain=.${domain}` : ''}`;
518
517
  document.cookie = cookieString;
519
518
  }
@@ -532,13 +531,13 @@ function getCookie(name) {
532
531
  }
533
532
  function deleteCookie(name) {
534
533
  if (isServer) return;
535
- const domain = getRootDomain();
534
+ const domain = getRootDomain(window.location.href);
536
535
  const cookieString = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/${domain ? `; domain=.${domain}` : ''}`;
537
536
  document.cookie = cookieString;
538
537
  }
539
538
  function migrateFromLocalStorage() {
540
539
  if (isServer) return;
541
- const keysToMigrate = [`${PREF}-session-id`, `${PREF}-anonymous-id`, `${PREF}-user-id`, `${PREF}-session-utm-context`];
540
+ const keysToMigrate = [`${PREF}-session-id`, `${PREF}-anonymous-id`, `${PREF}-user-id`, `${PREF}-session-utm-context`, `${PREF}-super-context`];
542
541
  keysToMigrate.forEach(key => {
543
542
  try {
544
543
  const value = localStorage.getItem(key);
@@ -646,22 +645,31 @@ function getUserId() {
646
645
  function setUserId(userId) {
647
646
  storeData(`user-id`, userId, USER_DURATION);
648
647
  }
649
- function getSessionUTMContext() {
650
- return retrieveData(`session-utm-context`);
648
+ function getSuperContext() {
649
+ return retrieveData('super-context') || {};
651
650
  }
652
- function setSessionUTMContext(utmContext) {
653
- storeData(`session-utm-context`, utmContext, SESSION_DURATION);
651
+ function setSuperContext(superContext) {
652
+ storeData('super-context', superContext, SESSION_DURATION);
654
653
  }
655
- function handleSessionUTMContext() {
656
- if (isServer) return null;
657
- const utmContext = getUTMContext();
658
- // If we have any utm data its current so we store it
659
- const utmContextKeys = Object.keys(utmContext);
660
- if (utmContextKeys.length > 0) {
661
- setSessionUTMContext(utmContext);
654
+ function updateSuperContext(browserContext) {
655
+ const existingSuperContext = getSuperContext();
656
+ const defaultSuperContextKeys = ['$utmSource', '$utmMedium', '$utmCampaign', '$utmTerm', '$utmContent', '$utmId', '$utmSourcePlatform', '$utmCampaignId', '$utmCreativeFormat', '$utmMarketingTactic'];
657
+ const superContext = defaultSuperContextKeys.reduce((acc, key) => {
658
+ const value = Object.assign({}, browserContext)[key];
659
+ if (value) acc[key] = value;
660
+ return acc;
661
+ }, existingSuperContext);
662
+ // Only set referrer if it's from a different root domain
663
+ // Prevents setting referrer when going between subdomains of the same root domain
664
+ if (browserContext.$referrer) {
665
+ const referrerRootDomain = getRootDomain(browserContext.$referrer);
666
+ const currentRootDomain = getRootDomain(browserContext.$href);
667
+ if (referrerRootDomain && currentRootDomain && referrerRootDomain !== currentRootDomain) {
668
+ superContext['$referrer'] = browserContext.$referrer;
669
+ }
662
670
  }
663
- // This will return the current data, or stored data if we have any
664
- return utmContext || getSessionUTMContext() || null;
671
+ setSuperContext(superContext);
672
+ return superContext;
665
673
  }
666
674
  class Saasco {
667
675
  /**
@@ -742,15 +750,16 @@ class Saasco {
742
750
  const sessionId = (hasAction ? undefined : actionOrPayload.sessionId) || getSessionId();
743
751
  const anonymousId = (hasAction ? undefined : actionOrPayload.anonymousId) || getAnonymousId();
744
752
  const distinctId = (hasAction ? undefined : actionOrPayload.userId) || getUserId();
745
- // Only gets browser and utm context if in the browser
753
+ // Only gets browser and super context if in the browser
746
754
  let browserContext;
747
- let utmContext;
755
+ let superContext;
748
756
  if (isBrowser) {
749
757
  browserContext = getBrowserContext();
750
- // handle session utm context and set it if it exists
751
- const sessionUTMContext = handleSessionUTMContext();
752
- if (sessionUTMContext) utmContext = sessionUTMContext;
758
+ superContext = updateSuperContext(browserContext);
753
759
  }
760
+ const payloadJSON = Object.assign(Object.assign(Object.assign({}, browserContext), superContext), {
761
+ properties: properties || {}
762
+ });
754
763
  const data = {
755
764
  id: uuid.v4(),
756
765
  timestamp: new Date().toISOString(),
@@ -760,9 +769,7 @@ class Saasco {
760
769
  anonymousId,
761
770
  distinctId,
762
771
  projectId: this.config.projectId,
763
- payload: JSON.stringify(Object.assign(Object.assign(Object.assign({}, browserContext), utmContext), {
764
- properties: properties || {}
765
- })),
772
+ payload: JSON.stringify(payloadJSON),
766
773
  source: isBrowser ? 'client' : 'server',
767
774
  context: JSON.stringify(context || {})
768
775
  };
@@ -843,8 +850,8 @@ class Saasco {
843
850
  *
844
851
  */
845
852
  logout() {
846
- // Clear UTM data on logout
847
- setSessionUTMContext(null);
853
+ // Clear super context data on logout
854
+ setSuperContext(null);
848
855
  this.identify(null);
849
856
  }
850
857
  /**
@@ -968,19 +975,20 @@ const browserContextSchema = zod.z.object({
968
975
  $screenHeight: zod.z.number(),
969
976
  $screenWidth: zod.z.number(),
970
977
  $title: zod.z.string(),
971
- $userAgent: zod.z.string()
972
- });
973
- const utmContextSchema = zod.z.object({
974
- $utmSource: zod.z.string().optional(),
975
- $utmMedium: zod.z.string().optional(),
976
- $utmCampaign: zod.z.string().optional(),
977
- $utmTerm: zod.z.string().optional(),
978
- $utmContent: zod.z.string().optional()
978
+ $userAgent: zod.z.string(),
979
+ $utmSource: zod.z.string().nullable(),
980
+ $utmMedium: zod.z.string().nullable(),
981
+ $utmCampaign: zod.z.string().nullable(),
982
+ $utmTerm: zod.z.string().nullable(),
983
+ $utmContent: zod.z.string().nullable(),
984
+ $utmId: zod.z.string().nullable(),
985
+ $utmSourcePlatform: zod.z.string().nullable(),
986
+ $utmCampaignId: zod.z.string().nullable(),
987
+ $utmCreativeFormat: zod.z.string().nullable(),
988
+ $utmMarketingTactic: zod.z.string().nullable()
979
989
  });
980
990
 
981
991
  exports.Saasco = Saasco;
982
992
  exports.browserContextSchema = browserContextSchema;
983
993
  exports.getBrowserContext = getBrowserContext;
984
- exports.getUTMContext = getUTMContext;
985
994
  exports.timezones = timezones;
986
- exports.utmContextSchema = utmContextSchema;
package/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import { v4 } from '@lukeed/uuid';
3
3
  import { isValid, parse } from 'psl';
4
4
  import { z } from 'zod';
5
5
 
6
- var version = "0.1.29";
6
+ var version = "0.1.30";
7
7
 
8
8
  const timezones = {
9
9
  'Asia/Barnaul': 'RU',
@@ -451,6 +451,17 @@ function getBrowserContext() {
451
451
  const $screenWidth = screen.width;
452
452
  const $title = document.title;
453
453
  const $userAgent = window.navigator.userAgent;
454
+ const params = new URLSearchParams(window.location.search);
455
+ const $utmSource = params.get('utm_source');
456
+ const $utmMedium = params.get('utm_medium');
457
+ const $utmCampaign = params.get('utm_campaign');
458
+ const $utmTerm = params.get('utm_term');
459
+ const $utmContent = params.get('utm_content');
460
+ const $utmId = params.get('utm_id');
461
+ const $utmSourcePlatform = params.get('utm_source_platform');
462
+ const $utmCampaignId = params.get('utm_campaign_id');
463
+ const $utmCreativeFormat = params.get('utm_creative_format');
464
+ const $utmMarketingTactic = params.get('utm_marketing_tactic');
454
465
  return {
455
466
  $locale,
456
467
  $location,
@@ -461,55 +472,43 @@ function getBrowserContext() {
461
472
  $screenHeight,
462
473
  $screenWidth,
463
474
  $title,
464
- $userAgent
475
+ $userAgent,
476
+ $utmSource,
477
+ $utmMedium,
478
+ $utmCampaign,
479
+ $utmTerm,
480
+ $utmContent,
481
+ $utmId,
482
+ $utmSourcePlatform,
483
+ $utmCampaignId,
484
+ $utmCreativeFormat,
485
+ $utmMarketingTactic
465
486
  };
466
487
  }
467
488
 
468
- function getUTMContext() {
469
- const isBrowser = typeof window !== 'undefined';
470
- if (!isBrowser) throw new Error('getUTMContext can only be called in browser');
471
- const params = new URLSearchParams(window.location.search);
472
- const $utmSource = params.get('utm_source');
473
- const $utmMedium = params.get('utm_medium');
474
- const $utmCampaign = params.get('utm_campaign');
475
- const $utmTerm = params.get('utm_term');
476
- const $utmContent = params.get('utm_content');
477
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, $utmSource ? {
478
- $utmSource
479
- } : {}), $utmMedium ? {
480
- $utmMedium
481
- } : {}), $utmCampaign ? {
482
- $utmCampaign
483
- } : {}), $utmTerm ? {
484
- $utmTerm
485
- } : {}), $utmContent ? {
486
- $utmContent
487
- } : {});
488
- }
489
-
490
489
  const isBrowser = typeof window !== 'undefined';
491
490
  const isServer = !isBrowser;
492
491
  const PREF = 'saasco-sdk';
493
492
  const SESSION_DURATION = 1000 * 60 * 30;
494
493
  const USER_DURATION = 1000 * 60 * 60 * 24 * 365;
495
494
  const data = {};
496
- function getRootDomain() {
495
+ function getRootDomain(url) {
497
496
  if (isServer) return;
498
- const hostname = window.location.hostname;
499
- if (!isValid(hostname)) {
500
- // If not a valid domain, don't set domain (for localhost, IP addresses, etc.)
501
- return undefined;
502
- }
503
- const parsed = parse(hostname);
504
- if ('domain' in parsed && parsed.domain) {
505
- return parsed.domain;
497
+ if (!url) return;
498
+ try {
499
+ const hostname = new URL(url).hostname;
500
+ if (!isValid(hostname)) return;
501
+ const parsed = parse(hostname);
502
+ if ('domain' in parsed && parsed.domain) return parsed.domain;
503
+ } catch (error) {
504
+ // invalid url
506
505
  }
507
- return undefined;
506
+ return;
508
507
  }
509
508
  function setCookie(name, value, ttl) {
510
509
  if (isServer) return;
511
510
  const expires = new Date(Date.now() + ttl).toUTCString();
512
- const domain = getRootDomain();
511
+ const domain = getRootDomain(window.location.href);
513
512
  const cookieString = `${name}=${encodeURIComponent(value)}; expires=${expires}; path=/${domain ? `; domain=.${domain}` : ''}`;
514
513
  document.cookie = cookieString;
515
514
  }
@@ -528,13 +527,13 @@ function getCookie(name) {
528
527
  }
529
528
  function deleteCookie(name) {
530
529
  if (isServer) return;
531
- const domain = getRootDomain();
530
+ const domain = getRootDomain(window.location.href);
532
531
  const cookieString = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/${domain ? `; domain=.${domain}` : ''}`;
533
532
  document.cookie = cookieString;
534
533
  }
535
534
  function migrateFromLocalStorage() {
536
535
  if (isServer) return;
537
- const keysToMigrate = [`${PREF}-session-id`, `${PREF}-anonymous-id`, `${PREF}-user-id`, `${PREF}-session-utm-context`];
536
+ const keysToMigrate = [`${PREF}-session-id`, `${PREF}-anonymous-id`, `${PREF}-user-id`, `${PREF}-session-utm-context`, `${PREF}-super-context`];
538
537
  keysToMigrate.forEach(key => {
539
538
  try {
540
539
  const value = localStorage.getItem(key);
@@ -642,22 +641,31 @@ function getUserId() {
642
641
  function setUserId(userId) {
643
642
  storeData(`user-id`, userId, USER_DURATION);
644
643
  }
645
- function getSessionUTMContext() {
646
- return retrieveData(`session-utm-context`);
644
+ function getSuperContext() {
645
+ return retrieveData('super-context') || {};
647
646
  }
648
- function setSessionUTMContext(utmContext) {
649
- storeData(`session-utm-context`, utmContext, SESSION_DURATION);
647
+ function setSuperContext(superContext) {
648
+ storeData('super-context', superContext, SESSION_DURATION);
650
649
  }
651
- function handleSessionUTMContext() {
652
- if (isServer) return null;
653
- const utmContext = getUTMContext();
654
- // If we have any utm data its current so we store it
655
- const utmContextKeys = Object.keys(utmContext);
656
- if (utmContextKeys.length > 0) {
657
- setSessionUTMContext(utmContext);
650
+ function updateSuperContext(browserContext) {
651
+ const existingSuperContext = getSuperContext();
652
+ const defaultSuperContextKeys = ['$utmSource', '$utmMedium', '$utmCampaign', '$utmTerm', '$utmContent', '$utmId', '$utmSourcePlatform', '$utmCampaignId', '$utmCreativeFormat', '$utmMarketingTactic'];
653
+ const superContext = defaultSuperContextKeys.reduce((acc, key) => {
654
+ const value = Object.assign({}, browserContext)[key];
655
+ if (value) acc[key] = value;
656
+ return acc;
657
+ }, existingSuperContext);
658
+ // Only set referrer if it's from a different root domain
659
+ // Prevents setting referrer when going between subdomains of the same root domain
660
+ if (browserContext.$referrer) {
661
+ const referrerRootDomain = getRootDomain(browserContext.$referrer);
662
+ const currentRootDomain = getRootDomain(browserContext.$href);
663
+ if (referrerRootDomain && currentRootDomain && referrerRootDomain !== currentRootDomain) {
664
+ superContext['$referrer'] = browserContext.$referrer;
665
+ }
658
666
  }
659
- // This will return the current data, or stored data if we have any
660
- return utmContext || getSessionUTMContext() || null;
667
+ setSuperContext(superContext);
668
+ return superContext;
661
669
  }
662
670
  class Saasco {
663
671
  /**
@@ -738,15 +746,16 @@ class Saasco {
738
746
  const sessionId = (hasAction ? undefined : actionOrPayload.sessionId) || getSessionId();
739
747
  const anonymousId = (hasAction ? undefined : actionOrPayload.anonymousId) || getAnonymousId();
740
748
  const distinctId = (hasAction ? undefined : actionOrPayload.userId) || getUserId();
741
- // Only gets browser and utm context if in the browser
749
+ // Only gets browser and super context if in the browser
742
750
  let browserContext;
743
- let utmContext;
751
+ let superContext;
744
752
  if (isBrowser) {
745
753
  browserContext = getBrowserContext();
746
- // handle session utm context and set it if it exists
747
- const sessionUTMContext = handleSessionUTMContext();
748
- if (sessionUTMContext) utmContext = sessionUTMContext;
754
+ superContext = updateSuperContext(browserContext);
749
755
  }
756
+ const payloadJSON = Object.assign(Object.assign(Object.assign({}, browserContext), superContext), {
757
+ properties: properties || {}
758
+ });
750
759
  const data = {
751
760
  id: v4(),
752
761
  timestamp: new Date().toISOString(),
@@ -756,9 +765,7 @@ class Saasco {
756
765
  anonymousId,
757
766
  distinctId,
758
767
  projectId: this.config.projectId,
759
- payload: JSON.stringify(Object.assign(Object.assign(Object.assign({}, browserContext), utmContext), {
760
- properties: properties || {}
761
- })),
768
+ payload: JSON.stringify(payloadJSON),
762
769
  source: isBrowser ? 'client' : 'server',
763
770
  context: JSON.stringify(context || {})
764
771
  };
@@ -839,8 +846,8 @@ class Saasco {
839
846
  *
840
847
  */
841
848
  logout() {
842
- // Clear UTM data on logout
843
- setSessionUTMContext(null);
849
+ // Clear super context data on logout
850
+ setSuperContext(null);
844
851
  this.identify(null);
845
852
  }
846
853
  /**
@@ -964,14 +971,17 @@ const browserContextSchema = z.object({
964
971
  $screenHeight: z.number(),
965
972
  $screenWidth: z.number(),
966
973
  $title: z.string(),
967
- $userAgent: z.string()
968
- });
969
- const utmContextSchema = z.object({
970
- $utmSource: z.string().optional(),
971
- $utmMedium: z.string().optional(),
972
- $utmCampaign: z.string().optional(),
973
- $utmTerm: z.string().optional(),
974
- $utmContent: z.string().optional()
974
+ $userAgent: z.string(),
975
+ $utmSource: z.string().nullable(),
976
+ $utmMedium: z.string().nullable(),
977
+ $utmCampaign: z.string().nullable(),
978
+ $utmTerm: z.string().nullable(),
979
+ $utmContent: z.string().nullable(),
980
+ $utmId: z.string().nullable(),
981
+ $utmSourcePlatform: z.string().nullable(),
982
+ $utmCampaignId: z.string().nullable(),
983
+ $utmCreativeFormat: z.string().nullable(),
984
+ $utmMarketingTactic: z.string().nullable()
975
985
  });
976
986
 
977
- export { Saasco, browserContextSchema, getBrowserContext, getUTMContext, timezones, utmContextSchema };
987
+ export { Saasco, browserContextSchema, getBrowserContext, timezones };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasco-sdk",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@lukeed/uuid": "^2.0.1",
package/src/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './lib/analytics';
2
2
  export * from './lib/getBrowserContext';
3
- export * from './lib/getUTMContext';
4
3
  export * from './lib/tracking';
5
4
  export * from './lib/timezones';
@@ -10,6 +10,16 @@ export declare const browserContextSchema: z.ZodObject<{
10
10
  $screenWidth: z.ZodNumber;
11
11
  $title: z.ZodString;
12
12
  $userAgent: z.ZodString;
13
+ $utmSource: z.ZodNullable<z.ZodString>;
14
+ $utmMedium: z.ZodNullable<z.ZodString>;
15
+ $utmCampaign: z.ZodNullable<z.ZodString>;
16
+ $utmTerm: z.ZodNullable<z.ZodString>;
17
+ $utmContent: z.ZodNullable<z.ZodString>;
18
+ $utmId: z.ZodNullable<z.ZodString>;
19
+ $utmSourcePlatform: z.ZodNullable<z.ZodString>;
20
+ $utmCampaignId: z.ZodNullable<z.ZodString>;
21
+ $utmCreativeFormat: z.ZodNullable<z.ZodString>;
22
+ $utmMarketingTactic: z.ZodNullable<z.ZodString>;
13
23
  }, "strip", z.ZodTypeAny, {
14
24
  $locale: string;
15
25
  $location: string;
@@ -21,6 +31,16 @@ export declare const browserContextSchema: z.ZodObject<{
21
31
  $screenWidth: number;
22
32
  $title: string;
23
33
  $userAgent: string;
34
+ $utmSource: string | null;
35
+ $utmMedium: string | null;
36
+ $utmCampaign: string | null;
37
+ $utmTerm: string | null;
38
+ $utmContent: string | null;
39
+ $utmId: string | null;
40
+ $utmSourcePlatform: string | null;
41
+ $utmCampaignId: string | null;
42
+ $utmCreativeFormat: string | null;
43
+ $utmMarketingTactic: string | null;
24
44
  }, {
25
45
  $locale: string;
26
46
  $location: string;
@@ -32,25 +52,16 @@ export declare const browserContextSchema: z.ZodObject<{
32
52
  $screenWidth: number;
33
53
  $title: string;
34
54
  $userAgent: string;
55
+ $utmSource: string | null;
56
+ $utmMedium: string | null;
57
+ $utmCampaign: string | null;
58
+ $utmTerm: string | null;
59
+ $utmContent: string | null;
60
+ $utmId: string | null;
61
+ $utmSourcePlatform: string | null;
62
+ $utmCampaignId: string | null;
63
+ $utmCreativeFormat: string | null;
64
+ $utmMarketingTactic: string | null;
35
65
  }>;
36
66
  export type BrowserContext = z.infer<typeof browserContextSchema>;
37
- export declare const utmContextSchema: z.ZodObject<{
38
- $utmSource: z.ZodOptional<z.ZodString>;
39
- $utmMedium: z.ZodOptional<z.ZodString>;
40
- $utmCampaign: z.ZodOptional<z.ZodString>;
41
- $utmTerm: z.ZodOptional<z.ZodString>;
42
- $utmContent: z.ZodOptional<z.ZodString>;
43
- }, "strip", z.ZodTypeAny, {
44
- $utmSource?: string | undefined;
45
- $utmMedium?: string | undefined;
46
- $utmCampaign?: string | undefined;
47
- $utmTerm?: string | undefined;
48
- $utmContent?: string | undefined;
49
- }, {
50
- $utmSource?: string | undefined;
51
- $utmMedium?: string | undefined;
52
- $utmCampaign?: string | undefined;
53
- $utmTerm?: string | undefined;
54
- $utmContent?: string | undefined;
55
- }>;
56
- export type UTMContext = z.infer<typeof utmContextSchema>;
67
+ export type SuperContext = Record<string, any>;
@@ -1,2 +0,0 @@
1
- import { UTMContext } from './tracking';
2
- export declare function getUTMContext(): UTMContext;