@codecademy/tracking 1.0.30 → 1.0.31-alpha.14e39ce069.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -93,7 +93,6 @@ setTimeout(() => {
93
93
  onError: logError,
94
94
  production: true,
95
95
  scope: window,
96
- user: { email: 'my@email.com', id: 'my-user-id' },
97
96
  writeKey: 'my-segment-write-key',
98
97
  });
99
98
  }, 1000);
@@ -1,9 +1,7 @@
1
- import { SegmentAnalytics, UserIntegrationSummary } from './types';
1
+ import { SegmentAnalytics } from './types';
2
2
  export type AnalyticsLoadOptions = {
3
3
  analytics: SegmentAnalytics;
4
4
  destinationPreferences: Record<string, boolean>;
5
- identifyPreferences: Record<string, boolean>;
6
- user?: UserIntegrationSummary;
7
5
  writeKey: string;
8
6
  };
9
- export declare const conditionallyLoadAnalytics: ({ analytics, destinationPreferences, identifyPreferences, user, writeKey, }: AnalyticsLoadOptions) => void;
7
+ export declare const conditionallyLoadAnalytics: ({ analytics, destinationPreferences, writeKey, }: AnalyticsLoadOptions) => void;
@@ -1,9 +1,6 @@
1
- import { getClientType } from './device';
2
1
  export const conditionallyLoadAnalytics = _ref => {
3
2
  let analytics = _ref.analytics,
4
3
  destinationPreferences = _ref.destinationPreferences,
5
- identifyPreferences = _ref.identifyPreferences,
6
- user = _ref.user,
7
4
  writeKey = _ref.writeKey;
8
5
  if (analytics.initialize) {
9
6
  return;
@@ -11,13 +8,4 @@ export const conditionallyLoadAnalytics = _ref => {
11
8
  analytics.load(writeKey, {
12
9
  integrations: destinationPreferences
13
10
  });
14
- if (user) {
15
- const identifyParams = {
16
- email: user.email,
17
- client: getClientType()
18
- };
19
- analytics.identify(user.id, identifyParams, {
20
- integrations: identifyPreferences
21
- });
22
- }
23
11
  };
@@ -1,4 +1,4 @@
1
- import { TrackingWindow, UserIntegrationSummary } from './types';
1
+ import { TrackingWindow } from './types';
2
2
  export type TrackingIntegrationsSettings = {
3
3
  /**
4
4
  * Called whenever a network request fails.
@@ -12,10 +12,6 @@ export type TrackingIntegrationsSettings = {
12
12
  * Global scope (often the window) where globals such as analytics are stored.
13
13
  */
14
14
  scope: TrackingWindow;
15
- /**
16
- * User details to identify in Segment.
17
- */
18
- user?: UserIntegrationSummary;
19
15
  /**
20
16
  * Whether user has opted out or is excluded from external tracking
21
17
  */
@@ -28,4 +24,4 @@ export type TrackingIntegrationsSettings = {
28
24
  /**
29
25
  * @see README.md for details and usage.
30
26
  */
31
- export declare const initializeTrackingIntegrations: ({ onError, production, scope, user, optedOutExternalTracking, writeKey, }: TrackingIntegrationsSettings) => Promise<void>;
27
+ export declare const initializeTrackingIntegrations: ({ onError, production, scope, optedOutExternalTracking, writeKey, }: TrackingIntegrationsSettings) => Promise<void>;
@@ -11,7 +11,6 @@ export const initializeTrackingIntegrations = async _ref => {
11
11
  let onError = _ref.onError,
12
12
  production = _ref.production,
13
13
  scope = _ref.scope,
14
- user = _ref.user,
15
14
  optedOutExternalTracking = _ref.optedOutExternalTracking,
16
15
  writeKey = _ref.writeKey;
17
16
  // 1. Wait 1000ms to allow any other post-hydration logic to run first
@@ -44,15 +43,12 @@ export const initializeTrackingIntegrations = async _ref => {
44
43
  consentDecision,
45
44
  destinations
46
45
  }),
47
- destinationPreferences = _mapDestinations.destinationPreferences,
48
- identifyPreferences = _mapDestinations.identifyPreferences;
46
+ destinationPreferences = _mapDestinations.destinationPreferences;
49
47
 
50
48
  // 6. We load only those allowed destinations using Segment's `analytics.load`
51
49
  conditionallyLoadAnalytics({
52
50
  analytics: scope.analytics,
53
51
  destinationPreferences,
54
- identifyPreferences,
55
- user,
56
52
  writeKey
57
53
  });
58
54
  };
@@ -9,5 +9,4 @@ export type DestinationMapOptions = {
9
9
  */
10
10
  export declare const mapDestinations: ({ consentDecision, destinations, }: DestinationMapOptions) => {
11
11
  destinationPreferences: Record<string, boolean>;
12
- identifyPreferences: Record<string, boolean>;
13
12
  };
@@ -33,14 +33,7 @@ export const mapDestinations = _ref => {
33
33
  [dest.id]: true
34
34
  };
35
35
  }));
36
- const identifyPreferences = {
37
- All: false,
38
- FullStory: consentDecision.includes(Consent.Performance),
39
- Hindsight: consentDecision.includes(Consent.Targeting),
40
- UserLeap: consentDecision.includes(Consent.Performance)
41
- };
42
36
  return {
43
- destinationPreferences,
44
- identifyPreferences
37
+ destinationPreferences
45
38
  };
46
39
  };
@@ -1,10 +1,5 @@
1
1
  import { Consent } from './consent';
2
- export interface UserIntegrationSummary {
3
- email: string;
4
- id: string;
5
- }
6
2
  export interface SegmentAnalytics {
7
- identify(id: string, details: Record<string, string>, options: SegmentAnalyticsOptions): void;
8
3
  initialize?: boolean;
9
4
  load(writeKey: string, options: SegmentAnalyticsOptions): void;
10
5
  page(): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/tracking",
3
3
  "description": "Tracking library for Codecademy",
4
- "version": "1.0.30",
4
+ "version": "1.0.31-alpha.14e39ce069.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "files": [
7
7
  "dist/**"
@@ -13,5 +13,5 @@
13
13
  "access": "public"
14
14
  },
15
15
  "repository": "git@github.com:codecademy-engineering/mono.git",
16
- "gitHead": "44724b40f129ac0fd3a9c78a8c2765d03f01dec5"
16
+ "gitHead": "f392ae024ee221361f8adf07de8f776a90d6c281"
17
17
  }