@guardian/ophan-tracker-js 2.6.1 → 2.6.3
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/NPM-dist/core.js +7 -7
- package/NPM-dist/manage-my-account.js +0 -1
- package/NPM-dist/ng.js +0 -1
- package/NPM-dist/support.js +0 -1
- package/NPM-dist/types/core.d.ts +3 -3
- package/NPM-dist/types/manage-my-account.d.ts +0 -1
- package/NPM-dist/types/ng.d.ts +0 -1
- package/NPM-dist/types/support.d.ts +0 -1
- package/NPM-dist/types/types/abtest.d.ts +13 -4
- package/NPM-dist/types/types/event.d.ts +2 -4
- package/package.json +1 -1
- package/NPM-dist/types/acquisition.js +0 -1
- package/NPM-dist/types/types/acquisition.d.ts +0 -116
package/NPM-dist/core.js
CHANGED
|
@@ -87,7 +87,7 @@ sendInitialEvent = function (httpStatus, url = location.href, referrer = window.
|
|
|
87
87
|
if (loadType !== 'normal') {
|
|
88
88
|
event.loadType = loadType;
|
|
89
89
|
}
|
|
90
|
-
appendContentType(event);
|
|
90
|
+
appendContentType(event, platform, window.guardian);
|
|
91
91
|
appendDataFromLocalStorageToEvent(event);
|
|
92
92
|
transmit.sendInitial(event);
|
|
93
93
|
return adblockDetection.run().then(function (adBlockerEnabled) {
|
|
@@ -198,13 +198,13 @@ storeDataToSendOnNextEvent = function (newData) {
|
|
|
198
198
|
/**
|
|
199
199
|
* Determines the 'content type' based on the platform and guardian object.
|
|
200
200
|
* @param {Record<string, unknown>} event - The event object that will be updated with contentType.
|
|
201
|
-
* @param {string}
|
|
202
|
-
* @param {Record<string, unknown>}
|
|
201
|
+
* @param {string} localPlatform - The current platform ('next-gen', 'embed' or other).
|
|
202
|
+
* @param {Record<string, unknown>} localGuardian - The guardian object.
|
|
203
203
|
*/
|
|
204
|
-
const appendContentType = (event,
|
|
205
|
-
const contentType =
|
|
206
|
-
?
|
|
207
|
-
:
|
|
204
|
+
const appendContentType = (event, localPlatform, localGuardian) => {
|
|
205
|
+
const contentType = localPlatform === 'next-gen' || localPlatform === 'embed'
|
|
206
|
+
? localGuardian?.config?.page?.contentType
|
|
207
|
+
: localGuardian?.page?.contentTypes;
|
|
208
208
|
if (contentType) {
|
|
209
209
|
event.contentType = contentType.toLowerCase();
|
|
210
210
|
}
|
|
@@ -33,7 +33,6 @@ export const record = exports.record;
|
|
|
33
33
|
export const viewId = exports.viewId;
|
|
34
34
|
// Type exports
|
|
35
35
|
export * from './types/abtest.js';
|
|
36
|
-
export * from './types/acquisition.js';
|
|
37
36
|
export * from './types/subscription.js';
|
|
38
37
|
export * from './types/interaction.js';
|
|
39
38
|
export * from './types/inpageclick.js';
|
package/NPM-dist/ng.js
CHANGED
|
@@ -8,7 +8,6 @@ import './click-path-capture.js';
|
|
|
8
8
|
import './perf.js';
|
|
9
9
|
import './iframe-tracking.js';
|
|
10
10
|
export * from './types/abtest.js';
|
|
11
|
-
export * from './types/acquisition.js';
|
|
12
11
|
export * from './types/subscription.js';
|
|
13
12
|
export * from './types/interaction.js';
|
|
14
13
|
export * from './types/inpageclick.js';
|
package/NPM-dist/support.js
CHANGED
|
@@ -32,7 +32,6 @@ export const record = supportExports.record;
|
|
|
32
32
|
export const viewId = supportExports.viewId;
|
|
33
33
|
// Type exports
|
|
34
34
|
export * from './types/abtest.js';
|
|
35
|
-
export * from './types/acquisition.js';
|
|
36
35
|
export * from './types/subscription.js';
|
|
37
36
|
export * from './types/interaction.js';
|
|
38
37
|
export * from './types/inpageclick.js';
|
package/NPM-dist/types/core.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare function processCaptures(): void;
|
|
|
58
58
|
/**
|
|
59
59
|
* Determines the 'content type' based on the platform and guardian object.
|
|
60
60
|
* @param {Record<string, unknown>} event - The event object that will be updated with contentType.
|
|
61
|
-
* @param {string}
|
|
62
|
-
* @param {Record<string, unknown>}
|
|
61
|
+
* @param {string} localPlatform - The current platform ('next-gen', 'embed' or other).
|
|
62
|
+
* @param {Record<string, unknown>} localGuardian - The guardian object.
|
|
63
63
|
*/
|
|
64
|
-
declare function appendContentType(event: Record<string, unknown>,
|
|
64
|
+
declare function appendContentType(event: Record<string, unknown>, localPlatform: string, localGuardian: Record<string, unknown>): void;
|
|
@@ -15,7 +15,6 @@ export default exports;
|
|
|
15
15
|
export declare const record: (event: EventPayload, callback?: () => void) => void;
|
|
16
16
|
export declare const viewId: string;
|
|
17
17
|
export * from './types/abtest.js';
|
|
18
|
-
export * from './types/acquisition.js';
|
|
19
18
|
export * from './types/subscription.js';
|
|
20
19
|
export * from './types/interaction.js';
|
|
21
20
|
export * from './types/inpageclick.js';
|
package/NPM-dist/types/ng.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import './click-path-capture.js';
|
|
|
2
2
|
import './perf.js';
|
|
3
3
|
import './iframe-tracking.js';
|
|
4
4
|
export * from './types/abtest.js';
|
|
5
|
-
export * from './types/acquisition.js';
|
|
6
5
|
export * from './types/subscription.js';
|
|
7
6
|
export * from './types/interaction.js';
|
|
8
7
|
export * from './types/inpageclick.js';
|
|
@@ -15,7 +15,6 @@ export default supportExports;
|
|
|
15
15
|
export declare const record: (event: EventPayload, callback?: () => void) => void;
|
|
16
16
|
export declare const viewId: string;
|
|
17
17
|
export * from './types/abtest.js';
|
|
18
|
-
export * from './types/acquisition.js';
|
|
19
18
|
export * from './types/subscription.js';
|
|
20
19
|
export * from './types/interaction.js';
|
|
21
20
|
export * from './types/inpageclick.js';
|
|
@@ -19,10 +19,19 @@ export interface AbTest {
|
|
|
19
19
|
*/
|
|
20
20
|
campaignCodes?: Array<string>;
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
22
|
+
export interface AbTestRegisterEntry {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* On the right-hand side of the map, the variant that they are seeing.
|
|
24
|
+
* Variant assigned to the user for this test
|
|
26
25
|
*/
|
|
27
|
-
|
|
26
|
+
variantName: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether this test has completed for the user
|
|
29
|
+
*/
|
|
30
|
+
complete: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Campaign codes associated with this variant
|
|
33
|
+
*/
|
|
34
|
+
campaignCodes?: Array<string>;
|
|
28
35
|
}
|
|
36
|
+
export type AbTestRegisterValue = AbTestRegisterEntry | string;
|
|
37
|
+
export type AbTestRegister = Record<string, AbTestRegisterValue>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Acquisition } from './acquisition.js';
|
|
1
|
+
import type { AbTestRegister } from './abtest.js';
|
|
3
2
|
import type { ComponentEvent } from './component-event.js';
|
|
4
3
|
import type { Consent } from './consent.js';
|
|
5
4
|
import type { InPageClick } from './inpageclick.js';
|
|
@@ -91,12 +90,11 @@ export interface EventPayload extends Partial<Consent>, Partial<InPageClick> {
|
|
|
91
90
|
performance?: WebPerformanceData;
|
|
92
91
|
audio?: AudioEvent;
|
|
93
92
|
video?: VideoEvent;
|
|
94
|
-
|
|
93
|
+
abTestRegister?: AbTestRegister;
|
|
95
94
|
lazyComponents?: LazyComponents;
|
|
96
95
|
interaction?: Interaction;
|
|
97
96
|
inPrivateBrowsingMode?: boolean;
|
|
98
97
|
adUnitWasHidden?: boolean;
|
|
99
|
-
acquisition?: Acquisition;
|
|
100
98
|
componentEvent?: ComponentEvent;
|
|
101
99
|
/** Experience contains information about the rendering of the page, e.g.: dotcom-rendering */
|
|
102
100
|
experiences?: Array<string>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { AbTestInfo } from './abtest.js';
|
|
2
|
-
import type { PrintOptions } from './printproduct.js';
|
|
3
|
-
import type { TComponentType } from './component-type.js';
|
|
4
|
-
import type { TPlatform } from './platform.js';
|
|
5
|
-
import type { Product } from './product.js';
|
|
6
|
-
/**
|
|
7
|
-
* A query string parameter
|
|
8
|
-
*/
|
|
9
|
-
export type QueryParameter = {
|
|
10
|
-
/**
|
|
11
|
-
* The name of the query string parameter
|
|
12
|
-
*/
|
|
13
|
-
name: string;
|
|
14
|
-
/**
|
|
15
|
-
* The value of the query string parameter
|
|
16
|
-
*/
|
|
17
|
-
value: string;
|
|
18
|
-
};
|
|
19
|
-
export type TPaymentFrequency = 'ONE_OFF' | 'MONTHLY' | 'ANNUALLY' | 'QUARTERLY' | 'SIX_MONTHLY';
|
|
20
|
-
export type TPaymentProvider = 'STRIPE' | 'PAYPAL' | 'GOCARDLESS' | 'IN_APP_PURCHASE' | 'STRIPE_APPLE_PAY' | 'STRIPE_PAYMENT_REQUEST_BUTTON' | 'SUBSCRIBE_WITH_GOOGLE' | 'AMAZON_PAY' | 'STRIPE_SEPA';
|
|
21
|
-
export type TAcquisitionSource = 'GUARDIAN_WEB'
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated DO NOT USE
|
|
24
|
-
*/
|
|
25
|
-
| 'GUARDIAN_APPS' | 'EMAIL' | 'SOCIAL' | 'SEARCH' | 'PPC' | 'DIRECT' | 'GUARDIAN_APP_IOS' | 'GUARDIAN_APP_ANDROID' | 'APPLE_NEWS' | 'GOOGLE_AMP' | 'YOUTUBE';
|
|
26
|
-
/**
|
|
27
|
-
* Represents monetary contribution made by a reader via this page.
|
|
28
|
-
*/
|
|
29
|
-
export interface Acquisition {
|
|
30
|
-
/**
|
|
31
|
-
* Product type
|
|
32
|
-
*/
|
|
33
|
-
product: Product;
|
|
34
|
-
/**
|
|
35
|
-
* If the payment is a one off or reccuring
|
|
36
|
-
*/
|
|
37
|
-
paymentFrequency: TPaymentFrequency;
|
|
38
|
-
/**
|
|
39
|
-
* Currency code (ISO 4217 3-character, upper-case, eg USD, GBP)
|
|
40
|
-
*/
|
|
41
|
-
currency: string;
|
|
42
|
-
/**
|
|
43
|
-
* Contributed amount in units of the currency received
|
|
44
|
-
*/
|
|
45
|
-
amount: number;
|
|
46
|
-
/**
|
|
47
|
-
* The payment provider the user paid with
|
|
48
|
-
*/
|
|
49
|
-
paymentProvider?: TPaymentProvider;
|
|
50
|
-
/**
|
|
51
|
-
* The campaign code of the campaign that the user came from
|
|
52
|
-
*/
|
|
53
|
-
campaignCode?: Array<string>;
|
|
54
|
-
/**
|
|
55
|
-
* The ab tests the user was in on dotcom
|
|
56
|
-
*/
|
|
57
|
-
abTests?: AbTestInfo;
|
|
58
|
-
/**
|
|
59
|
-
* ISO-3166-aplha-2 country code representing where the user is from. It is either the country of the card used, or the country of the contributor's address
|
|
60
|
-
*/
|
|
61
|
-
countryCode?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Page view id of the page the reader was on that lead them through to the contribution page e.g. by clicking on the Contribute Now button in the Epic component
|
|
64
|
-
*/
|
|
65
|
-
referrerPageViewId?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Url of the page the reader was on that lead them through to the contribution page e.g. by clicking on the Contribute Now button in the Epic component
|
|
68
|
-
*/
|
|
69
|
-
referrerUrl?: string;
|
|
70
|
-
/**
|
|
71
|
-
* An ID that can be used to distinguish different instances of a given component type
|
|
72
|
-
*/
|
|
73
|
-
componentId?: string;
|
|
74
|
-
/**
|
|
75
|
-
* The type of component that the acquisition came from
|
|
76
|
-
*/
|
|
77
|
-
componentTypeV2?: TComponentType;
|
|
78
|
-
/**
|
|
79
|
-
* The source of the acquisition
|
|
80
|
-
*/
|
|
81
|
-
source?: TAcquisitionSource;
|
|
82
|
-
/**
|
|
83
|
-
* Extra parameters only applicable to print products
|
|
84
|
-
*/
|
|
85
|
-
printOptions?: PrintOptions;
|
|
86
|
-
/**
|
|
87
|
-
* Platform on which the acquisition occurred e.g. Contributions, S&C
|
|
88
|
-
*/
|
|
89
|
-
platform?: TPlatform;
|
|
90
|
-
/**
|
|
91
|
-
* Length of the discount in months
|
|
92
|
-
*/
|
|
93
|
-
discountLengthInMonths?: number;
|
|
94
|
-
/**
|
|
95
|
-
* Amount of discount, as a percentage
|
|
96
|
-
*/
|
|
97
|
-
discountPercentage?: number;
|
|
98
|
-
/**
|
|
99
|
-
* Promo code for the acquisition. Only applicable to subscriptions.
|
|
100
|
-
*/
|
|
101
|
-
promoCode?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Any additional labels.
|
|
104
|
-
* In particular, extra information that is needed to calculate Annualised Value
|
|
105
|
-
* for this Acquisition (e.g. promotions like Guardian Weekly Six For Six) can go here.
|
|
106
|
-
*/
|
|
107
|
-
labels?: Array<string>;
|
|
108
|
-
/**
|
|
109
|
-
* The identity id of a user
|
|
110
|
-
*/
|
|
111
|
-
identityId?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Query string parameters associated with an acquisition
|
|
114
|
-
*/
|
|
115
|
-
queryParameters?: Array<QueryParameter>;
|
|
116
|
-
}
|