@schibsted/pulse-sdk 8.0.0-rc.16 → 8.0.0-rc.18
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/dist/cjs/Tracker.js +246 -74
- package/dist/cjs/tpaas-builders/builders/pageContent.js +7 -0
- package/dist/cjs/tpaas-builders/builders/pageSports.js +7 -0
- package/dist/cjs/tpaas-builders/builders/trackerBuilder.js +1 -3
- package/dist/cjs/tpaas-builders/builders.js +63 -25
- package/dist/cjs/tpaas-schemas/constants.js +109 -53
- package/dist/cjs/tracker-proxy/consts.js +8 -0
- package/dist/cjs/version.js +1 -1
- package/dist/ejs/Tracker.js +248 -76
- package/dist/ejs/tpaas-builders/builders/pageContent.js +3 -0
- package/dist/ejs/tpaas-builders/builders/pageSports.js +3 -0
- package/dist/ejs/tpaas-builders/builders/trackerBuilder.js +1 -3
- package/dist/ejs/tpaas-builders/builders.js +56 -26
- package/dist/ejs/tpaas-schemas/constants.js +107 -51
- package/dist/ejs/tracker-proxy/consts.js +8 -0
- package/dist/ejs/version.js +1 -1
- package/dist/types/Tracker.d.ts +45 -16
- package/dist/types/tpaas-builders/builders/pageContent.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageSports.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/trackerBuilder.d.ts +1 -1
- package/dist/types/tpaas-builders/builders.d.ts +9 -3
- package/dist/types/tpaas-builders/types.d.ts +4 -3
- package/dist/types/tpaas-schemas/constants.d.ts +107 -51
- package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +16 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAd.d.ts +117 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAffiliate.d.ts +5 -1
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAudio.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/schemas/IEngagementSportsUIElement.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideo.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAd.d.ts +115 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAffiliate.d.ts +5 -1
- package/dist/types/tpaas-schemas/types/schemas/IImpressionSportsUIElement.d.ts +109 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveListing.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedPage.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveWeather.d.ts +4 -4
- package/dist/types/tpaas-schemas/types/schemas/ILoadAd.d.ts +119 -0
- package/dist/types/tpaas-schemas/types/schemas/IRequestAd.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewListing.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedPage.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewWeather.d.ts +4 -4
- package/dist/types/tpaas-schemas/types/schemas/index.d.ts +8 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthTraining.d.ts +4 -0
- package/dist/types/tpaas-schemas/types/templates/ISession.d.ts +1 -1
- package/dist/types/tpaas-schemas/types/templates/ITracker.d.ts +0 -10
- package/dist/types/tpaas-schemas/types.d.ts +6 -3
- package/dist/types/tracker-proxy/consts.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/Tracker.js
CHANGED
|
@@ -172,12 +172,12 @@ function unsubscribe(eventName, callback) {
|
|
|
172
172
|
* @class Tracker
|
|
173
173
|
*/
|
|
174
174
|
class Tracker {
|
|
175
|
-
async getCurrentTpaasPage() {
|
|
176
|
-
const { id, type, url } = await
|
|
175
|
+
async getCurrentTpaasPage(currentPageInfo = this.currentPageContext.info) {
|
|
176
|
+
const { id, type, url } = await currentPageInfo;
|
|
177
177
|
return (0, map_page_to_page_ref_1.mapPageToPageRef)(id, type, url);
|
|
178
178
|
}
|
|
179
179
|
async getCurrentLegacyPage() {
|
|
180
|
-
const { id, type, url } = await this.
|
|
180
|
+
const { id, type, url } = await this.currentPageContext.info;
|
|
181
181
|
// make sure the pageType is valid for legacy events
|
|
182
182
|
const validatedType = (0, types_1.isLegacyPageType)(type) ? type : 'Page';
|
|
183
183
|
return {
|
|
@@ -206,37 +206,33 @@ class Tracker {
|
|
|
206
206
|
this.legacyVisibilityObservers = new Map();
|
|
207
207
|
this.visibilityObservers = new Map();
|
|
208
208
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* This is used as the source of truth for the current page's information, which is updated based on the View Page-level event
|
|
212
|
-
* As a single source of truth for the current page, this needs to be compatible between legacy and TPaaS events, hence the need for a custom data type.
|
|
213
|
-
* Legacy events can provide an id with SDRN, while TPaaS events don't need it
|
|
209
|
+
* Current page state shared by legacy and TPaaS tracking. See CurrentPageContext for
|
|
210
|
+
* which properties are shared and which are exclusively TPaaS metadata.
|
|
214
211
|
*/
|
|
215
|
-
this.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* @private
|
|
222
|
-
*
|
|
223
|
-
* This is used as the source of truth for the current page's referrer information, which is updated based on the View Page-level event
|
|
224
|
-
* !! This is only used in TPaaS events and contexts, as we don't want to risk changing the behaviour of legacy events
|
|
225
|
-
* This is also the reason this is being kept as a separate variable from the currentPageInfo property,
|
|
226
|
-
* which is used for both legacy and TPaaS events
|
|
227
|
-
*/
|
|
228
|
-
this.currentPageReferrer = {
|
|
229
|
-
url: utils_1.isBrowser ? document.referrer || undefined : undefined,
|
|
230
|
-
};
|
|
231
|
-
this.setCurrentTpaasPageData = (id, type, referrer) => {
|
|
232
|
-
this.currentPageInfo = {
|
|
233
|
-
id: id || 'unknown',
|
|
234
|
-
type: type || 'Page',
|
|
212
|
+
this.currentPageContext = {
|
|
213
|
+
info: {
|
|
214
|
+
id: 'unknown',
|
|
215
|
+
type: 'Page',
|
|
235
216
|
url: utils_1.isBrowser ? window.location.href : undefined,
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
217
|
+
},
|
|
218
|
+
referrer: {
|
|
219
|
+
url: utils_1.isBrowser ? document.referrer || undefined : undefined,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
this.setCurrentTpaasPageData = ({ id, type, referrer, content, sports, }) => {
|
|
223
|
+
// TPaaS Views replace the context, intentionally resetting omitted content and sports.
|
|
224
|
+
this.currentPageContext = {
|
|
225
|
+
info: {
|
|
226
|
+
id: id || 'unknown',
|
|
227
|
+
type: type || 'Page',
|
|
228
|
+
url: utils_1.isBrowser ? window.location.href : undefined,
|
|
229
|
+
},
|
|
230
|
+
referrer: {
|
|
231
|
+
...referrer,
|
|
232
|
+
url: referrer?.url ?? (utils_1.isBrowser ? document.referrer || undefined : undefined),
|
|
233
|
+
},
|
|
234
|
+
content,
|
|
235
|
+
sports,
|
|
240
236
|
};
|
|
241
237
|
};
|
|
242
238
|
/**
|
|
@@ -250,8 +246,9 @@ class Tracker {
|
|
|
250
246
|
*/
|
|
251
247
|
this.hasProxyListener = false;
|
|
252
248
|
this.setPageDefaults = (pageViewEvent) => {
|
|
253
|
-
|
|
254
|
-
this.
|
|
249
|
+
// Legacy Views update only the shared properties, preserving TPaaS-only content and sports.
|
|
250
|
+
this.currentPageContext.info = (0, page_from_page_view_1.pageFromPageView)(pageViewEvent);
|
|
251
|
+
this.currentPageContext.referrer = Promise.resolve(pageViewEvent.origin).then((originProperties) => (0, map_page_to_page_ref_1.mapPageToPageRef)(originProperties?.id, originProperties?.type, originProperties?.url));
|
|
255
252
|
if (pageViewEvent.origin) {
|
|
256
253
|
const pageDefaults = { origin: pageViewEvent.origin };
|
|
257
254
|
this.update(pageDefaults, true);
|
|
@@ -517,6 +514,11 @@ class Tracker {
|
|
|
517
514
|
* @category TPaaS Tracking
|
|
518
515
|
*/
|
|
519
516
|
async prepareAnonymousTpaasEvent() {
|
|
517
|
+
const { isHybrid, pageViewId, providerId, component, componentVersion, deployStageTpaas } = this.state;
|
|
518
|
+
const providerName = this.state.provider?.name;
|
|
519
|
+
const providerGroup = this.state.provider?.group;
|
|
520
|
+
const experimentsInput = this.builders.experiments;
|
|
521
|
+
const currentPageReferrerInput = this.currentPageContext.referrer;
|
|
520
522
|
try {
|
|
521
523
|
await this._applyRemoteConfigEndpoints();
|
|
522
524
|
}
|
|
@@ -524,20 +526,19 @@ class Tracker {
|
|
|
524
526
|
loglevel_1.default.trace('Failed to sync remote config', ex);
|
|
525
527
|
}
|
|
526
528
|
const [experiments, currentPageReferrer] = await Promise.all([
|
|
527
|
-
this.adaptExperiments(
|
|
528
|
-
|
|
529
|
+
this.adaptExperiments(experimentsInput),
|
|
530
|
+
currentPageReferrerInput,
|
|
529
531
|
]);
|
|
530
532
|
return {
|
|
531
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
532
533
|
version: version_1.SDK_VERSION,
|
|
533
|
-
isHybrid: !!
|
|
534
|
-
pageviewId:
|
|
535
|
-
providerId
|
|
536
|
-
providerName
|
|
537
|
-
providerGroup
|
|
538
|
-
component
|
|
539
|
-
componentVersion
|
|
540
|
-
routingStage: mapDeployStageToTpaasStage(
|
|
534
|
+
isHybrid: !!isHybrid,
|
|
535
|
+
pageviewId: pageViewId,
|
|
536
|
+
providerId,
|
|
537
|
+
providerName,
|
|
538
|
+
providerGroup,
|
|
539
|
+
component,
|
|
540
|
+
componentVersion,
|
|
541
|
+
routingStage: mapDeployStageToTpaasStage(deployStageTpaas),
|
|
541
542
|
experiments,
|
|
542
543
|
currentPageReferrer,
|
|
543
544
|
};
|
|
@@ -547,8 +548,15 @@ class Tracker {
|
|
|
547
548
|
* @category TPaaS Tracking
|
|
548
549
|
*/
|
|
549
550
|
async prepareTpaasEvent() {
|
|
551
|
+
// Capture event context before any asynchronous work so a concurrent update or View
|
|
552
|
+
// event cannot change the dependencies used to finish building this event.
|
|
553
|
+
const builders = { ...this.builders };
|
|
554
|
+
const { isHybrid, providerId, component, componentVersion, pageViewId, deployStageTpaas } = this.state;
|
|
555
|
+
const providerName = this.state.provider?.name;
|
|
556
|
+
const providerGroup = this.state.provider?.group;
|
|
557
|
+
const { info: currentPageInfoInput, content: currentPageContent, sports: currentPageSports, referrer: currentPageReferrerInput, } = this.currentPageContext;
|
|
550
558
|
try {
|
|
551
|
-
await this.syncRemoteResources(undefined,
|
|
559
|
+
await this.syncRemoteResources(undefined, builders);
|
|
552
560
|
}
|
|
553
561
|
catch (ex) {
|
|
554
562
|
loglevel_1.default.trace('Failed to sync remote resources', ex);
|
|
@@ -602,28 +610,31 @@ class Tracker {
|
|
|
602
610
|
source: source || 'unknown',
|
|
603
611
|
};
|
|
604
612
|
}
|
|
613
|
+
// Consents are intentionally not part of the event-context snapshot. Read them after
|
|
614
|
+
// remote synchronization so a blocking tracking call can use newly resolved consents.
|
|
605
615
|
const [actor, consents, experiments, currentPage, currentPageReferrer] = await Promise.all([
|
|
606
|
-
|
|
616
|
+
identity.getActor(builders),
|
|
607
617
|
this.getConsents(),
|
|
608
|
-
this.adaptExperiments(
|
|
609
|
-
this.getCurrentTpaasPage(),
|
|
610
|
-
|
|
618
|
+
this.adaptExperiments(builders.experiments),
|
|
619
|
+
this.getCurrentTpaasPage(currentPageInfoInput),
|
|
620
|
+
currentPageReferrerInput,
|
|
611
621
|
]);
|
|
612
622
|
const { environmentId, jwe } = (0, cis_sync_1.parsePulseCookies)();
|
|
613
623
|
return {
|
|
614
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
615
624
|
version: version_1.SDK_VERSION,
|
|
616
|
-
isHybrid: !!
|
|
625
|
+
isHybrid: !!isHybrid,
|
|
617
626
|
user: adaptActorToNewFormat(actor),
|
|
618
627
|
consents: adaptConsentsToNewFormat(consents),
|
|
619
|
-
providerId
|
|
620
|
-
providerName
|
|
621
|
-
providerGroup
|
|
622
|
-
component
|
|
623
|
-
componentVersion
|
|
624
|
-
pageviewId:
|
|
625
|
-
routingStage: mapDeployStageToTpaasStage(
|
|
628
|
+
providerId,
|
|
629
|
+
providerName,
|
|
630
|
+
providerGroup,
|
|
631
|
+
component,
|
|
632
|
+
componentVersion,
|
|
633
|
+
pageviewId: pageViewId,
|
|
634
|
+
routingStage: mapDeployStageToTpaasStage(deployStageTpaas),
|
|
626
635
|
currentPage,
|
|
636
|
+
currentPageContent,
|
|
637
|
+
currentPageSports,
|
|
627
638
|
currentPageReferrer,
|
|
628
639
|
experiments,
|
|
629
640
|
environmentId,
|
|
@@ -883,7 +894,11 @@ class Tracker {
|
|
|
883
894
|
}
|
|
884
895
|
async trackViewHealthPage(input, options) {
|
|
885
896
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
886
|
-
this.setCurrentTpaasPageData(
|
|
897
|
+
this.setCurrentTpaasPageData({
|
|
898
|
+
id: input.object.objectId,
|
|
899
|
+
type: tpaas_schemas_1.ViewHealthPage.object.objectType,
|
|
900
|
+
referrer: input.page?.referrer,
|
|
901
|
+
});
|
|
887
902
|
const dependencies = await this.prepareTpaasEvent();
|
|
888
903
|
const event = (0, tpaas_builders_1.buildViewHealthPageEvent)(input, dependencies);
|
|
889
904
|
const result = this.sendTpaasEvent(event);
|
|
@@ -923,7 +938,11 @@ class Tracker {
|
|
|
923
938
|
*/
|
|
924
939
|
async trackViewPage(input, options) {
|
|
925
940
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
926
|
-
this.setCurrentTpaasPageData(
|
|
941
|
+
this.setCurrentTpaasPageData({
|
|
942
|
+
id: input.object.objectId,
|
|
943
|
+
type: tpaas_schemas_1.ViewPage.object.objectType,
|
|
944
|
+
referrer: input.page?.referrer,
|
|
945
|
+
});
|
|
927
946
|
const dependencies = await this.prepareTpaasEvent();
|
|
928
947
|
const event = (0, tpaas_builders_1.buildViewPageEvent)(input, dependencies);
|
|
929
948
|
const result = this.sendTpaasEvent(event);
|
|
@@ -949,7 +968,12 @@ class Tracker {
|
|
|
949
968
|
*/
|
|
950
969
|
async trackViewSportsPage(input, options) {
|
|
951
970
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
952
|
-
this.setCurrentTpaasPageData(
|
|
971
|
+
this.setCurrentTpaasPageData({
|
|
972
|
+
id: input.object.objectId,
|
|
973
|
+
type: tpaas_schemas_1.ViewSportsPage.object.objectType,
|
|
974
|
+
referrer: input.page?.referrer,
|
|
975
|
+
sports: input.object.sports,
|
|
976
|
+
});
|
|
953
977
|
const dependencies = await this.prepareTpaasEvent();
|
|
954
978
|
const event = (0, tpaas_builders_1.buildViewSportsPageEvent)(input, dependencies);
|
|
955
979
|
const result = this.sendTpaasEvent(event);
|
|
@@ -974,7 +998,11 @@ class Tracker {
|
|
|
974
998
|
*/
|
|
975
999
|
async trackViewTitle(input) {
|
|
976
1000
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
977
|
-
this.setCurrentTpaasPageData(
|
|
1001
|
+
this.setCurrentTpaasPageData({
|
|
1002
|
+
id: input.object.objectId,
|
|
1003
|
+
type: tpaas_schemas_1.ViewTitle.object.objectType,
|
|
1004
|
+
referrer: input.page?.referrer,
|
|
1005
|
+
});
|
|
978
1006
|
const dependencies = await this.prepareTpaasEvent();
|
|
979
1007
|
const event = (0, tpaas_builders_1.buildViewTitleEvent)(input, dependencies);
|
|
980
1008
|
return this.sendTpaasEvent(event);
|
|
@@ -989,6 +1017,24 @@ class Tracker {
|
|
|
989
1017
|
const event = (0, tpaas_builders_1.buildImpressionWidgetEvent)(input, dependencies);
|
|
990
1018
|
return this.sendTpaasEvent(event);
|
|
991
1019
|
}
|
|
1020
|
+
/**
|
|
1021
|
+
* @param input
|
|
1022
|
+
* @category TPaaS Tracking
|
|
1023
|
+
*/
|
|
1024
|
+
async trackLoadAd(input) {
|
|
1025
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1026
|
+
const event = (0, tpaas_builders_1.buildLoadAdEvent)(input, dependencies);
|
|
1027
|
+
return this.sendTpaasEvent(event);
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* @param input
|
|
1031
|
+
* @category TPaaS Tracking
|
|
1032
|
+
*/
|
|
1033
|
+
async trackRequestAd(input) {
|
|
1034
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1035
|
+
const event = (0, tpaas_builders_1.buildRequestAdEvent)(input, dependencies);
|
|
1036
|
+
return this.sendTpaasEvent(event);
|
|
1037
|
+
}
|
|
992
1038
|
/**
|
|
993
1039
|
* @param input
|
|
994
1040
|
* @param options
|
|
@@ -996,7 +1042,12 @@ class Tracker {
|
|
|
996
1042
|
*/
|
|
997
1043
|
async trackViewArticle(input, options) {
|
|
998
1044
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
999
|
-
this.setCurrentTpaasPageData(
|
|
1045
|
+
this.setCurrentTpaasPageData({
|
|
1046
|
+
id: input.object.objectId,
|
|
1047
|
+
type: tpaas_schemas_1.ViewArticle.object.objectType,
|
|
1048
|
+
referrer: input.page?.referrer,
|
|
1049
|
+
content: input.page?.content,
|
|
1050
|
+
});
|
|
1000
1051
|
const dependencies = await this.prepareTpaasEvent();
|
|
1001
1052
|
const event = (0, tpaas_builders_1.buildViewArticleEvent)(input, dependencies);
|
|
1002
1053
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1057,7 +1108,12 @@ class Tracker {
|
|
|
1057
1108
|
*/
|
|
1058
1109
|
async trackViewAudioPage(input, options) {
|
|
1059
1110
|
this.newPageView();
|
|
1060
|
-
this.setCurrentTpaasPageData(
|
|
1111
|
+
this.setCurrentTpaasPageData({
|
|
1112
|
+
id: input.object.objectId,
|
|
1113
|
+
type: tpaas_schemas_1.ViewAudioPage.object.objectType,
|
|
1114
|
+
referrer: input.page?.referrer,
|
|
1115
|
+
content: input.page?.content,
|
|
1116
|
+
});
|
|
1061
1117
|
const dependencies = await this.prepareTpaasEvent();
|
|
1062
1118
|
const event = (0, tpaas_builders_1.buildViewAudioPageEvent)(input, dependencies);
|
|
1063
1119
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1095,7 +1151,11 @@ class Tracker {
|
|
|
1095
1151
|
*/
|
|
1096
1152
|
async trackViewError(input, options) {
|
|
1097
1153
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1098
|
-
this.setCurrentTpaasPageData(
|
|
1154
|
+
this.setCurrentTpaasPageData({
|
|
1155
|
+
id: input.object.objectId,
|
|
1156
|
+
type: tpaas_schemas_1.ViewError.object.objectType,
|
|
1157
|
+
referrer: input.page?.referrer,
|
|
1158
|
+
});
|
|
1099
1159
|
const dependencies = await this.prepareTpaasEvent();
|
|
1100
1160
|
const event = (0, tpaas_builders_1.buildViewErrorEvent)(input, dependencies);
|
|
1101
1161
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1114,6 +1174,15 @@ class Tracker {
|
|
|
1114
1174
|
}
|
|
1115
1175
|
return result;
|
|
1116
1176
|
}
|
|
1177
|
+
/**
|
|
1178
|
+
* @param input
|
|
1179
|
+
* @category TPaaS Tracking
|
|
1180
|
+
*/
|
|
1181
|
+
async trackImpressionAd(input) {
|
|
1182
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1183
|
+
const event = (0, tpaas_builders_1.buildImpressionAdEvent)(input, dependencies);
|
|
1184
|
+
return this.sendTpaasEvent(event);
|
|
1185
|
+
}
|
|
1117
1186
|
/**
|
|
1118
1187
|
* @param input
|
|
1119
1188
|
* @category TPaaS Tracking
|
|
@@ -1159,6 +1228,15 @@ class Tracker {
|
|
|
1159
1228
|
const event = (0, tpaas_builders_1.buildImpressionPlayerEvent)(input, dependencies);
|
|
1160
1229
|
return this.sendTpaasEvent(event);
|
|
1161
1230
|
}
|
|
1231
|
+
/**
|
|
1232
|
+
* @param input
|
|
1233
|
+
* @category TPaaS Tracking
|
|
1234
|
+
*/
|
|
1235
|
+
async trackImpressionSportsUIElement(input) {
|
|
1236
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1237
|
+
const event = (0, tpaas_builders_1.buildImpressionSportsUIElementEvent)(input, dependencies);
|
|
1238
|
+
return this.sendTpaasEvent(event);
|
|
1239
|
+
}
|
|
1162
1240
|
/**
|
|
1163
1241
|
* @param input
|
|
1164
1242
|
* @category TPaaS Tracking
|
|
@@ -1184,7 +1262,11 @@ class Tracker {
|
|
|
1184
1262
|
*/
|
|
1185
1263
|
async trackViewFrontpage(input, options) {
|
|
1186
1264
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1187
|
-
this.setCurrentTpaasPageData(
|
|
1265
|
+
this.setCurrentTpaasPageData({
|
|
1266
|
+
id: input.object.objectId,
|
|
1267
|
+
type: tpaas_schemas_1.ViewFrontpage.object.objectType,
|
|
1268
|
+
referrer: input.page?.referrer,
|
|
1269
|
+
});
|
|
1188
1270
|
const dependencies = await this.prepareTpaasEvent();
|
|
1189
1271
|
const event = (0, tpaas_builders_1.buildViewFrontpageEvent)(input, dependencies);
|
|
1190
1272
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1210,7 +1292,11 @@ class Tracker {
|
|
|
1210
1292
|
*/
|
|
1211
1293
|
async trackViewLandingpage(input, options) {
|
|
1212
1294
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1213
|
-
this.setCurrentTpaasPageData(
|
|
1295
|
+
this.setCurrentTpaasPageData({
|
|
1296
|
+
id: input.object.objectId,
|
|
1297
|
+
type: tpaas_schemas_1.ViewLandingpage.object.objectType,
|
|
1298
|
+
referrer: input.page?.referrer,
|
|
1299
|
+
});
|
|
1214
1300
|
const dependencies = await this.prepareTpaasEvent();
|
|
1215
1301
|
const event = (0, tpaas_builders_1.buildViewLandingpageEvent)(input, dependencies);
|
|
1216
1302
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1236,7 +1322,11 @@ class Tracker {
|
|
|
1236
1322
|
*/
|
|
1237
1323
|
async trackViewListing(input, options) {
|
|
1238
1324
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1239
|
-
this.setCurrentTpaasPageData(
|
|
1325
|
+
this.setCurrentTpaasPageData({
|
|
1326
|
+
id: input.object.objectId,
|
|
1327
|
+
type: tpaas_schemas_1.ViewListing.object.objectType,
|
|
1328
|
+
referrer: input.page?.referrer,
|
|
1329
|
+
});
|
|
1240
1330
|
const dependencies = await this.prepareTpaasEvent();
|
|
1241
1331
|
const event = (0, tpaas_builders_1.buildViewListingEvent)(input, dependencies);
|
|
1242
1332
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1262,7 +1352,12 @@ class Tracker {
|
|
|
1262
1352
|
*/
|
|
1263
1353
|
async trackViewLockedArticle(input, options) {
|
|
1264
1354
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1265
|
-
this.setCurrentTpaasPageData(
|
|
1355
|
+
this.setCurrentTpaasPageData({
|
|
1356
|
+
id: input.object.objectId,
|
|
1357
|
+
type: tpaas_schemas_1.ViewLockedArticle.object.objectType,
|
|
1358
|
+
referrer: input.page?.referrer,
|
|
1359
|
+
content: input.page?.content,
|
|
1360
|
+
});
|
|
1266
1361
|
const dependencies = await this.prepareTpaasEvent();
|
|
1267
1362
|
const event = (0, tpaas_builders_1.buildViewLockedArticleEvent)(input, dependencies);
|
|
1268
1363
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1288,7 +1383,12 @@ class Tracker {
|
|
|
1288
1383
|
*/
|
|
1289
1384
|
async trackViewLockedAudioPage(input, options) {
|
|
1290
1385
|
this.newPageView();
|
|
1291
|
-
this.setCurrentTpaasPageData(
|
|
1386
|
+
this.setCurrentTpaasPageData({
|
|
1387
|
+
id: input.object.objectId,
|
|
1388
|
+
type: tpaas_schemas_1.ViewLockedAudioPage.object.objectType,
|
|
1389
|
+
referrer: input.page?.referrer,
|
|
1390
|
+
content: input.page?.content,
|
|
1391
|
+
});
|
|
1292
1392
|
const dependencies = await this.prepareTpaasEvent();
|
|
1293
1393
|
const event = (0, tpaas_builders_1.buildViewLockedAudioPageEvent)(input, dependencies);
|
|
1294
1394
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1307,6 +1407,37 @@ class Tracker {
|
|
|
1307
1407
|
}
|
|
1308
1408
|
return result;
|
|
1309
1409
|
}
|
|
1410
|
+
/**
|
|
1411
|
+
* @param input
|
|
1412
|
+
* @param options
|
|
1413
|
+
* @category TPaaS Tracking
|
|
1414
|
+
*/
|
|
1415
|
+
async trackViewLockedPage(input, options) {
|
|
1416
|
+
this.newPageView();
|
|
1417
|
+
// LockedPage is not currently part of the catalog's PageRef.pageType enum.
|
|
1418
|
+
this.setCurrentTpaasPageData({
|
|
1419
|
+
id: input.object.objectId,
|
|
1420
|
+
type: 'Page',
|
|
1421
|
+
referrer: input.page?.referrer,
|
|
1422
|
+
});
|
|
1423
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1424
|
+
const event = (0, tpaas_builders_1.buildViewLockedPageEvent)(input, dependencies);
|
|
1425
|
+
const result = this.sendTpaasEvent(event);
|
|
1426
|
+
if ((0, leaveTrackingTpaas_1.shouldEnableLeaveTracking)(options.leaveTracking)) {
|
|
1427
|
+
const leaveLockedPageCallback = async (leave) => {
|
|
1428
|
+
await this.trackLeaveLockedPage({
|
|
1429
|
+
leave,
|
|
1430
|
+
...input,
|
|
1431
|
+
});
|
|
1432
|
+
};
|
|
1433
|
+
(0, leaveTrackingTpaas_1.addTpaasLeaveTracking)({
|
|
1434
|
+
...options.leaveTracking,
|
|
1435
|
+
schema: tpaas_schemas_1.LeaveLockedPage.object.objectType,
|
|
1436
|
+
trackMethod: leaveLockedPageCallback,
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
return result;
|
|
1440
|
+
}
|
|
1310
1441
|
/**
|
|
1311
1442
|
* @param input
|
|
1312
1443
|
* @param options
|
|
@@ -1314,7 +1445,12 @@ class Tracker {
|
|
|
1314
1445
|
*/
|
|
1315
1446
|
async trackViewLockedVideoPage(input, options) {
|
|
1316
1447
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1317
|
-
this.setCurrentTpaasPageData(
|
|
1448
|
+
this.setCurrentTpaasPageData({
|
|
1449
|
+
id: input.object.objectId,
|
|
1450
|
+
type: tpaas_schemas_1.ViewLockedVideoPage.object.objectType,
|
|
1451
|
+
referrer: input.page?.referrer,
|
|
1452
|
+
content: input.page?.content,
|
|
1453
|
+
});
|
|
1318
1454
|
const dependencies = await this.prepareTpaasEvent();
|
|
1319
1455
|
const event = (0, tpaas_builders_1.buildViewLockedVideoPageEvent)(input, dependencies);
|
|
1320
1456
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1377,7 +1513,12 @@ class Tracker {
|
|
|
1377
1513
|
*/
|
|
1378
1514
|
async trackViewVideoPage(input, options) {
|
|
1379
1515
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1380
|
-
this.setCurrentTpaasPageData(
|
|
1516
|
+
this.setCurrentTpaasPageData({
|
|
1517
|
+
id: input.object.objectId,
|
|
1518
|
+
type: tpaas_schemas_1.ViewVideoPage.object.objectType,
|
|
1519
|
+
referrer: input.page?.referrer,
|
|
1520
|
+
content: input.page?.content,
|
|
1521
|
+
});
|
|
1381
1522
|
const dependencies = await this.prepareTpaasEvent();
|
|
1382
1523
|
const event = (0, tpaas_builders_1.buildViewVideoPageEvent)(input, dependencies);
|
|
1383
1524
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1410,7 +1551,11 @@ class Tracker {
|
|
|
1410
1551
|
*/
|
|
1411
1552
|
async trackViewWeather(input, options) {
|
|
1412
1553
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1413
|
-
this.setCurrentTpaasPageData(
|
|
1554
|
+
this.setCurrentTpaasPageData({
|
|
1555
|
+
id: input.object.objectId,
|
|
1556
|
+
type: tpaas_schemas_1.ViewWeather.object.objectType,
|
|
1557
|
+
referrer: input.page?.referrer,
|
|
1558
|
+
});
|
|
1414
1559
|
const dependencies = await this.prepareTpaasEvent();
|
|
1415
1560
|
const event = (0, tpaas_builders_1.buildViewWeatherEvent)(input, dependencies);
|
|
1416
1561
|
const result = this.sendTpaasEvent(event);
|
|
@@ -1501,6 +1646,15 @@ class Tracker {
|
|
|
1501
1646
|
const event = (0, tpaas_builders_1.buildLeaveLockedAudioPageEvent)(input, dependencies);
|
|
1502
1647
|
return this.sendTpaasEvent(event);
|
|
1503
1648
|
}
|
|
1649
|
+
/**
|
|
1650
|
+
* @param input
|
|
1651
|
+
* @category TPaaS Tracking
|
|
1652
|
+
*/
|
|
1653
|
+
async trackLeaveLockedPage(input) {
|
|
1654
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1655
|
+
const event = (0, tpaas_builders_1.buildLeaveLockedPageEvent)(input, dependencies);
|
|
1656
|
+
return this.sendTpaasEvent(event);
|
|
1657
|
+
}
|
|
1504
1658
|
/**
|
|
1505
1659
|
* @param input
|
|
1506
1660
|
* @category TPaaS Tracking
|
|
@@ -1546,6 +1700,15 @@ class Tracker {
|
|
|
1546
1700
|
const event = (0, tpaas_builders_1.buildLeaveWeatherEvent)(input, dependencies);
|
|
1547
1701
|
return this.sendTpaasEvent(event);
|
|
1548
1702
|
}
|
|
1703
|
+
/**
|
|
1704
|
+
* @param input
|
|
1705
|
+
* @category TPaaS Tracking
|
|
1706
|
+
*/
|
|
1707
|
+
async trackEngagementAd(input) {
|
|
1708
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1709
|
+
const event = (0, tpaas_builders_1.buildEngagementAdEvent)(input, dependencies);
|
|
1710
|
+
return this.sendTpaasEvent(event);
|
|
1711
|
+
}
|
|
1549
1712
|
/**
|
|
1550
1713
|
* @param input
|
|
1551
1714
|
* @category TPaaS Tracking
|
|
@@ -1582,6 +1745,15 @@ class Tracker {
|
|
|
1582
1745
|
const event = (0, tpaas_builders_1.buildEngagementOfferEvent)(input, dependencies);
|
|
1583
1746
|
return this.sendTpaasEvent(event);
|
|
1584
1747
|
}
|
|
1748
|
+
/**
|
|
1749
|
+
* @param input
|
|
1750
|
+
* @category TPaaS Tracking
|
|
1751
|
+
*/
|
|
1752
|
+
async trackEngagementSportsUIElement(input) {
|
|
1753
|
+
const dependencies = await this.prepareTpaasEvent();
|
|
1754
|
+
const event = (0, tpaas_builders_1.buildEngagementSportsUIElementEvent)(input, dependencies);
|
|
1755
|
+
return this.sendTpaasEvent(event);
|
|
1756
|
+
}
|
|
1585
1757
|
/**
|
|
1586
1758
|
* @param input
|
|
1587
1759
|
* @category TPaaS Tracking
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.builder = void 0;
|
|
4
|
-
const builder = ({
|
|
4
|
+
const builder = ({ isHybrid, routingStage, version, }) => {
|
|
5
5
|
return {
|
|
6
6
|
tracker: {
|
|
7
|
-
autoTrackerVersion,
|
|
8
|
-
isAutoTracker: !!autoTrackerVersion,
|
|
9
7
|
isHybrid,
|
|
10
8
|
routingStage,
|
|
11
9
|
trackerType: 'JS',
|