@schibsted/pulse-sdk 8.0.0-rc.2 → 8.0.0-rc.21
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 +582 -471
- package/dist/cjs/app-integration.js +3 -3
- package/dist/cjs/builders/actor.js +6 -6
- package/dist/cjs/builders/consents.js +8 -8
- package/dist/cjs/builders/device-browser.js +8 -8
- package/dist/cjs/builders/device-node.js +3 -3
- package/dist/cjs/builders/events-anonymous-node.js +3 -3
- package/dist/cjs/builders/events-node.js +7 -7
- package/dist/cjs/builders/experimentMetadata.js +2 -2
- package/dist/cjs/builders/experiments.js +1 -0
- package/dist/cjs/builders/objects/objects-anonymous-browser.js +2 -2
- package/dist/cjs/builders/objects/objects-anonymous-node.js +9 -9
- package/dist/cjs/builders/objects/objects-browser.js +2 -2
- package/dist/cjs/builders/objects/objects-node.js +10 -10
- package/dist/cjs/builders/objects/utils.js +3 -3
- package/dist/cjs/builders/origin-browser.js +2 -2
- package/dist/cjs/builders/origin-node.js +4 -4
- package/dist/cjs/builders/session-browser.js +6 -80
- package/dist/cjs/cis-sync/cis-browser.js +219 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/cis.js +0 -1
- package/dist/cjs/cis-sync/eventEmitter.js +37 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/index.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/pulse-cookie.js +53 -63
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/cis-sync}/storage/pulseStorage.js +28 -21
- package/dist/cjs/cis-sync/storage/storage.js +24 -0
- package/dist/cjs/createPulseTracker.js +4 -4
- package/dist/cjs/identity/actor.js +20 -8
- package/dist/cjs/identity/advertising.js +1 -1
- package/dist/cjs/identity/cis.js +7 -6
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/leaveTracking/index.js +10 -10
- package/dist/cjs/leaveTrackingTpaas/constants.js +2 -7
- package/dist/cjs/leaveTrackingTpaas/index.js +70 -46
- package/dist/cjs/network-browser.js +3 -3
- package/dist/cjs/remoteConfig/index.js +5 -5
- package/dist/cjs/session/store.js +96 -0
- package/dist/cjs/tpaas-builders/builders/catalogVersion.js +9 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/device.js +50 -72
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/navigationType.js +2 -3
- package/dist/cjs/tpaas-builders/builders/pageContent.js +7 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/pageInfo.js +2 -3
- package/dist/cjs/tpaas-builders/builders/pageSports.js +7 -0
- package/dist/cjs/tpaas-builders/builders/provider.js +19 -0
- package/dist/cjs/tpaas-builders/builders/referrer.js +17 -0
- package/dist/cjs/tpaas-builders/builders/session.js +5 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/trackerBuilder.js +2 -3
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/user.js +1 -1
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/utm.js +3 -9
- package/dist/cjs/tpaas-builders/builders.js +326 -0
- package/dist/cjs/tpaas-builders/guards.js +7 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/index.js +3 -0
- package/dist/cjs/tpaas-context/adapters.js +85 -0
- package/dist/cjs/tpaas-context/browser.js +51 -0
- package/dist/cjs/tpaas-context/index.js +6 -0
- package/dist/cjs/tpaas-context/prepare.js +177 -0
- package/dist/cjs/tpaas-context/session.js +23 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/cjs/tpaas-context}/types.js +0 -1
- package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/constants.js +189 -158
- package/{node_modules/@schibsted/tpaas-schemas/dist/cjs → dist/cjs/tpaas-schemas}/index.js +1 -0
- package/dist/cjs/tpaas-schemas/types.js +2 -0
- package/dist/cjs/tracker-proxy/consts.js +29 -7
- package/dist/cjs/tracker-proxy/proxy-provider.js +2 -2
- package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/index.js +4 -1
- package/dist/cjs/utils/xDomainId.js +15 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/visibility-observer/index.js +9 -7
- package/dist/cjs/wrapper/types/event.js +5 -0
- package/dist/cjs/wrapper/utils/map-page-to-page-ref.js +13 -0
- package/dist/ejs/Tracker.js +558 -447
- package/dist/ejs/app-integration.js +1 -1
- package/dist/ejs/builders/actor.js +3 -3
- package/dist/ejs/builders/consents.js +4 -4
- package/dist/ejs/builders/device-browser.js +2 -2
- package/dist/ejs/builders/device-node.js +1 -1
- package/dist/ejs/builders/events-anonymous-node.js +1 -1
- package/dist/ejs/builders/events-node.js +4 -4
- package/dist/ejs/builders/experimentMetadata.js +1 -1
- package/dist/ejs/builders/experiments.js +1 -1
- package/dist/ejs/builders/objects/objects-anonymous-browser.js +1 -1
- package/dist/ejs/builders/objects/objects-anonymous-node.js +1 -1
- package/dist/ejs/builders/objects/objects-browser.js +1 -1
- package/dist/ejs/builders/objects/objects-node.js +1 -1
- package/dist/ejs/builders/objects/utils.js +1 -1
- package/dist/ejs/builders/origin-browser.js +1 -1
- package/dist/ejs/builders/origin-node.js +1 -1
- package/dist/ejs/builders/session-browser.js +5 -77
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/cis-browser.js +17 -4
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/cis.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/eventEmitter.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/index.js +0 -1
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/pulse-cookie.js +1 -2
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/storage/pulseStorage.js +12 -4
- package/{node_modules/@schibsted/pulse-cis-sync/dist/ejs → dist/ejs/cis-sync}/storage/storage.js +6 -2
- package/dist/ejs/createPulseTracker.js +1 -1
- package/dist/ejs/identity/actor.js +21 -9
- package/dist/ejs/identity/advertising.js +1 -1
- package/dist/ejs/identity/cis.js +4 -3
- package/dist/ejs/index.js +4 -3
- package/dist/ejs/leaveTracking/index.js +1 -1
- package/dist/ejs/leaveTrackingTpaas/constants.js +1 -5
- package/dist/ejs/leaveTrackingTpaas/index.js +65 -41
- package/dist/ejs/network-browser.js +1 -1
- package/dist/ejs/remoteConfig/index.js +1 -1
- package/dist/ejs/session/store.js +90 -0
- package/dist/ejs/tpaas-builders/builders/catalogVersion.js +6 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/device.js +50 -72
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/navigationType.js +2 -3
- package/dist/ejs/tpaas-builders/builders/pageContent.js +3 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/pageInfo.js +2 -3
- package/dist/ejs/tpaas-builders/builders/pageSports.js +3 -0
- package/dist/ejs/tpaas-builders/builders/provider.js +16 -0
- package/dist/ejs/tpaas-builders/builders/referrer.js +13 -0
- package/dist/ejs/tpaas-builders/builders/session.js +1 -0
- package/dist/ejs/tpaas-builders/builders/trackerBuilder.js +10 -0
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/user.js +1 -1
- package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/utm.js +3 -9
- package/dist/ejs/tpaas-builders/builders.js +259 -0
- package/dist/ejs/tpaas-builders/guards.js +4 -0
- package/dist/ejs/tpaas-builders/index.js +2 -0
- package/dist/ejs/tpaas-context/adapters.js +80 -0
- package/dist/ejs/tpaas-context/browser.js +47 -0
- package/dist/ejs/tpaas-context/index.js +1 -0
- package/dist/ejs/tpaas-context/prepare.js +137 -0
- package/dist/ejs/tpaas-context/session.js +19 -0
- package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/constants.js +187 -156
- package/{node_modules/@schibsted/tpaas-schemas/dist/ejs → dist/ejs/tpaas-schemas}/index.js +1 -0
- package/dist/ejs/tpaas-schemas/types.js +1 -0
- package/dist/ejs/tracker-proxy/consts.js +29 -7
- package/dist/ejs/tracker-proxy/proxy-provider.js +1 -1
- package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/index.js +1 -0
- package/dist/ejs/utils/xDomainId.js +11 -0
- package/dist/ejs/version.js +1 -1
- package/dist/ejs/visibility-observer/index.js +9 -7
- package/dist/ejs/wrapper/types/event.js +4 -1
- package/dist/ejs/wrapper/utils/map-page-to-page-ref.js +10 -0
- package/dist/types/Tracker.d.ts +198 -93
- package/dist/types/builders/actor.d.ts +3 -2
- package/dist/types/builders/consents.d.ts +3 -3
- package/dist/types/builders/device-node.d.ts +2 -2
- package/dist/types/builders/events-anonymous-node.d.ts +4 -4
- package/dist/types/builders/events-node.d.ts +5 -5
- package/dist/types/builders/experiments.d.ts +1 -0
- package/dist/types/builders/index.d.ts +1 -1
- package/dist/types/builders/objects/objects-anonymous-node.d.ts +1 -1
- package/dist/types/builders/objects/objects-node.d.ts +1 -1
- package/dist/types/builders/origin-node.d.ts +1 -1
- package/dist/types/builders/session-browser.d.ts +1 -13
- package/{node_modules/@schibsted/pulse-cis-sync/dist/types → dist/types/cis-sync}/cis-browser.d.ts +1 -0
- package/{node_modules/@schibsted/pulse-cis-sync/dist/types → dist/types/cis-sync}/storage/pulseStorage.d.ts +12 -4
- package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/storage/storage.d.ts +2 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/createPulseTracker.d.ts +1 -1
- package/dist/types/identity/actor.d.ts +3 -3
- package/dist/types/identity/advertising.d.ts +2 -2
- package/dist/types/identity/cis.d.ts +4 -4
- package/dist/types/index.d.ts +7 -8
- package/dist/types/leaveTrackingTpaas/constants.d.ts +1 -5
- package/dist/types/leaveTrackingTpaas/index.d.ts +6 -6
- package/dist/types/leaveTrackingTpaas/types.d.ts +2 -10
- package/dist/types/session/store.d.ts +34 -0
- package/dist/types/tpaas-builders/builders/anonymous.d.ts +3 -0
- package/dist/types/tpaas-builders/builders/baseEvent.d.ts +3 -0
- package/dist/types/tpaas-builders/builders/catalogVersion.d.ts +3 -0
- package/dist/types/tpaas-builders/builders/consents.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/device.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/experiments.d.ts +9 -0
- package/dist/types/tpaas-builders/builders/navigationType.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageContent.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageInfo.d.ts +7 -0
- package/dist/types/tpaas-builders/builders/pageSports.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/pageviewId.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/provider.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/referrer.d.ts +6 -0
- package/dist/types/tpaas-builders/builders/session.d.ts +4 -0
- package/dist/types/tpaas-builders/builders/time.d.ts +4 -0
- package/dist/types/tpaas-builders/builders/trackerBuilder.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/user.d.ts +5 -0
- package/dist/types/tpaas-builders/builders/utm.d.ts +7 -0
- package/dist/types/tpaas-builders/builders.d.ts +141 -0
- package/dist/types/tpaas-builders/guards.d.ts +2 -0
- package/dist/types/tpaas-builders/index.d.ts +2 -0
- package/dist/types/tpaas-context/adapters.d.ts +26 -0
- package/dist/types/tpaas-context/browser.d.ts +8 -0
- package/dist/types/tpaas-context/index.d.ts +2 -0
- package/dist/types/tpaas-context/prepare.d.ts +38 -0
- package/dist/types/tpaas-context/session.d.ts +10 -0
- package/dist/types/tpaas-context/types.d.ts +66 -0
- package/dist/types/tpaas-schemas/constants.d.ts +471 -0
- package/dist/types/tpaas-schemas/index.d.ts +5 -0
- package/dist/types/tpaas-schemas/types/ITpaasEvent.d.ts +130 -0
- package/dist/types/tpaas-schemas/types/schemas/IAnonymousImpressionUIElement.d.ts +58 -0
- package/dist/types/tpaas-schemas/types/schemas/ICompletedHealthAction.d.ts +139 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAd.d.ts +117 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAffiliate.d.ts +144 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementAudio.d.ts +213 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementForm.d.ts +111 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementHealthUIElement.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementOffer.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementSchoolUIElement.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementSportsUIElement.d.ts +157 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTeaser.d.ts +114 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTvModule.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementTvSearch.d.ts +142 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementUIElement.d.ts +105 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideo.d.ts +238 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementVideoAd.d.ts +147 -0
- package/dist/types/tpaas-schemas/types/schemas/IEngagementWidget.d.ts +91 -0
- package/dist/types/tpaas-schemas/types/schemas/IHeartbeatCommercialArticle.d.ts +96 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAd.d.ts +115 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAdSlot.d.ts +89 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionAffiliate.d.ts +142 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionForm.d.ts +113 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionHealthUIElement.d.ts +138 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionOffer.d.ts +109 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionPlayer.d.ts +108 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionSchoolUIElement.d.ts +109 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionSportsUIElement.d.ts +159 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionTeaser.d.ts +112 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionUIElement.d.ts +107 -0
- package/dist/types/tpaas-schemas/types/schemas/IImpressionWidget.d.ts +89 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveArticle.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveAudioPage.d.ts +88 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveError.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveFrontpage.d.ts +83 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLandingpage.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveListing.d.ts +123 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedArticle.d.ts +139 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedAudioPage.d.ts +97 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedPage.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveLockedVideoPage.d.ts +97 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeavePage.d.ts +82 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveSchoolPage.d.ts +84 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveSportsPage.d.ts +137 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveVideoPage.d.ts +91 -0
- package/dist/types/tpaas-schemas/types/schemas/ILeaveWeather.d.ts +96 -0
- package/dist/types/tpaas-schemas/types/schemas/ILoadAd.d.ts +119 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewArticle.d.ts +133 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewAudioPage.d.ts +87 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewError.d.ts +90 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewFrontpage.d.ts +80 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewHealthPage.d.ts +119 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLandingpage.d.ts +76 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewListing.d.ts +118 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedArticle.d.ts +139 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedAudioPage.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedPage.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewLockedVideoPage.d.ts +95 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewPage.d.ts +86 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewSchoolPage.d.ts +88 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewSportsPage.d.ts +135 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewTitle.d.ts +92 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewVideoPage.d.ts +87 -0
- package/dist/types/tpaas-schemas/types/schemas/IViewWeather.d.ts +94 -0
- package/dist/types/tpaas-schemas/types/schemas/index.d.ts +63 -0
- package/dist/types/tpaas-schemas/types/templates/IBranded.d.ts +42 -0
- package/dist/types/tpaas-schemas/types/templates/IConsents.d.ts +34 -0
- package/dist/types/tpaas-schemas/types/templates/IContent.d.ts +56 -0
- package/dist/types/tpaas-schemas/types/templates/IDevice.d.ts +62 -0
- package/dist/types/tpaas-schemas/types/templates/IEngagement.d.ts +21 -0
- package/dist/types/tpaas-schemas/types/templates/IExperiments.d.ts +35 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthFood.d.ts +55 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthOrigin.d.ts +27 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthPhysicalActivity.d.ts +36 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthTraining.d.ts +74 -0
- package/dist/types/tpaas-schemas/types/templates/IHealthUserData.d.ts +25 -0
- package/dist/types/tpaas-schemas/types/templates/ILeave.d.ts +54 -0
- package/dist/types/tpaas-schemas/types/templates/ILeaveAudio.d.ts +37 -0
- package/dist/types/tpaas-schemas/types/templates/ILeaveStories.d.ts +34 -0
- package/dist/types/tpaas-schemas/types/templates/ILocation.d.ts +21 -0
- package/dist/types/tpaas-schemas/types/templates/IMetrics.d.ts +32 -0
- package/dist/types/tpaas-schemas/types/templates/IPageRef.d.ts +46 -0
- package/dist/types/tpaas-schemas/types/templates/IPlacement.d.ts +45 -0
- package/dist/types/tpaas-schemas/types/templates/IProvider.d.ts +73 -0
- package/dist/types/tpaas-schemas/types/templates/ISchool.d.ts +74 -0
- package/dist/types/tpaas-schemas/types/templates/ISession.d.ts +33 -0
- package/dist/types/tpaas-schemas/types/templates/ISports.d.ts +98 -0
- package/dist/types/tpaas-schemas/types/templates/ISportsUserFeatures.d.ts +28 -0
- package/dist/types/tpaas-schemas/types/templates/ITime.d.ts +32 -0
- package/dist/types/tpaas-schemas/types/templates/ITracker.d.ts +37 -0
- package/dist/types/tpaas-schemas/types/templates/IUser.d.ts +34 -0
- package/dist/types/tpaas-schemas/types/templates/IUtmTags.d.ts +38 -0
- package/dist/types/tpaas-schemas/types/templates/index.d.ts +27 -0
- package/dist/types/tpaas-schemas/types.d.ts +42 -0
- package/dist/types/tracker-proxy/consts.d.ts +2 -2
- package/dist/types/types.d.ts +21 -17
- package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/index.d.ts +1 -0
- package/dist/types/utils/xDomainId.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/visibility-observer/index.d.ts +6 -1
- package/dist/types/wrapper/engagement/ui-element/types.d.ts +1 -1
- package/dist/types/wrapper/types/base-event.d.ts +1 -1
- package/dist/types/wrapper/types/event.d.ts +4 -2
- package/dist/types/wrapper/types/utils.d.ts +1 -1
- package/dist/types/wrapper/utils/map-page-to-page-ref.d.ts +3 -0
- package/dist/types/wrapper/view/article/types.d.ts +1 -1
- package/dist/types/wrapper/view/frontpage/types.d.ts +1 -1
- package/dist/types/wrapper/view/listing/types.d.ts +1 -1
- package/dist/types/wrapper/view/loginposter/types.d.ts +1 -1
- package/dist/types/wrapper/view/page/types.d.ts +1 -1
- package/dist/types/wrapper/view/salesposter/types.d.ts +1 -1
- package/dist/types/wrapper/view/ui-element/types.d.ts +1 -1
- package/package.json +21 -20
- package/dist/cjs/Tracker.test-d.js +0 -76
- package/dist/ejs/Tracker.test-d.js +0 -71
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.d.ts +0 -26
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js +0 -273
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis-browser.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/cis.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js +0 -39
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/eventEmitter.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/index.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/pulse-cookie.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.d.ts +0 -36
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/pulseStorage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js +0 -21
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/storage/storage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/cjs/types.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.d.ts +0 -26
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis-browser.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.d.ts +0 -10
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/cis.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.d.ts +0 -14
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/eventEmitter.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.d.ts +0 -4
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/index.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.d.ts +0 -55
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/pulse-cookie.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.d.ts +0 -36
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/pulseStorage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.d.ts +0 -6
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/storage/storage.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.d.ts +0 -24
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js +0 -2
- package/node_modules/@schibsted/pulse-cis-sync/dist/ejs/types.js.map +0 -1
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/cis.d.ts +0 -10
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/eventEmitter.d.ts +0 -14
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/index.d.ts +0 -4
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/pulse-cookie.d.ts +0 -55
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/storage/storage.d.ts +0 -6
- package/node_modules/@schibsted/pulse-cis-sync/dist/types/types.d.ts +0 -24
- package/node_modules/@schibsted/pulse-cis-sync/package.json +0 -44
- package/node_modules/@schibsted/pulse-utils/package.json +0 -36
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/provider.js +0 -12
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/referrer.js +0 -19
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders/session.js +0 -114
- package/node_modules/@schibsted/tpaas-event-builder/dist/cjs/builders.js +0 -272
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/provider.js +0 -9
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/referrer.js +0 -15
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/session.js +0 -108
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders/trackerBuilder.js +0 -11
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/builders.js +0 -215
- package/node_modules/@schibsted/tpaas-event-builder/dist/ejs/index.js +0 -1
- package/node_modules/@schibsted/tpaas-event-builder/dist/index.d.ts +0 -5403
- package/node_modules/@schibsted/tpaas-event-builder/package.json +0 -40
- package/node_modules/@schibsted/tpaas-schemas/dist/index.d.ts +0 -6176
- package/node_modules/@schibsted/tpaas-schemas/package.json +0 -35
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/cis-sync}/types.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/anonymous.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/baseEvent.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/consents.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/experiments.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/pageviewId.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/cjs → dist/cjs/tpaas-builders}/builders/time.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/cookie-config.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/cookie.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/events.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/get.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/getRootDomain.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/merge.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/objects.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/omit.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/randomString.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/throttle.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/cjs → dist/cjs/utils}/webApi.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/cis-sync}/types.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/anonymous.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/baseEvent.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/consents.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/experiments.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/pageviewId.js +0 -0
- /package/{node_modules/@schibsted/tpaas-event-builder/dist/ejs → dist/ejs/tpaas-builders}/builders/time.js +0 -0
- /package/dist/{types/Tracker.test-d.d.ts → ejs/tpaas-context/types.js} +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/cookie-config.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/cookie.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/events.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/get.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/getRootDomain.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/merge.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/objects.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/omit.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/randomString.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/throttle.js +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/ejs → dist/ejs/utils}/webApi.js +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/cis.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/eventEmitter.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/index.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/pulse-cookie.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-cis-sync/dist/cjs → dist/types/cis-sync}/types.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/cookie-config.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/cookie.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/events.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/get.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/getRootDomain.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/merge.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/objects.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/omit.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/randomString.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/throttle.d.ts +0 -0
- /package/{node_modules/@schibsted/pulse-utils/dist/types → dist/types/utils}/webApi.d.ts +0 -0
package/dist/ejs/Tracker.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { parsePulseCookies } from '@schibsted/pulse-cis-sync';
|
|
2
|
-
import { evaluateAndFlatten, isBrowser, isFunction, isPromise, isString, pulseMerge, throttle, } from '@schibsted/pulse-utils';
|
|
3
|
-
import { buildAnonymousViewUIElementEvent, buildCompletedHealthActionEvent, buildEngagementAudioEvent, buildEngagementFormEvent, buildEngagementHealthUIElementEvent, buildEngagementOfferEvent, buildEngagementTeaserEvent, buildEngagementUIElementEvent, buildEngagementVideoAdEvent, buildEngagementVideoEvent, buildEngagementWidgetEvent, buildImpressionAdSlotEvent, buildImpressionFormEvent, buildImpressionHealthUIElementEvent, buildImpressionOfferEvent, buildImpressionPlayerEvent, buildImpressionTeaserEvent, buildImpressionUIElementEvent, buildImpressionWidgetEvent, buildLeaveArticleEvent, buildLeaveAudioPageEvent, buildLeaveErrorEvent, buildLeaveFrontpageEvent, buildLeaveLandingpageEvent, buildLeaveListingEvent, buildLeaveLockedArticleEvent, buildLeaveLockedAudioEvent, buildLeaveLockedAudioPageEvent, buildLeaveLockedVideoEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveSportsPageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildViewArticleEvent, buildViewAudioEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioEvent, buildViewLockedAudioPageEvent, buildViewLockedVideoEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewSportsPageEvent, buildViewTitleEvent, buildViewVideoEvent, buildViewVideoPageEvent, buildViewWeatherEvent, getCommonBuildersOutput, } from '@schibsted/tpaas-event-builder';
|
|
4
|
-
import { LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudioPage, LeaveLockedVideoPage, LeavePage, LeaveSportsPage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewError, ViewFrontpage, ViewListing, ViewLockedArticle, ViewLockedVideo, ViewPage, ViewTitle, } from '@schibsted/tpaas-schemas';
|
|
5
1
|
import logger from 'loglevel';
|
|
6
2
|
import { v4 } from 'uuid';
|
|
7
3
|
import { getDefaultAltHandler, getDefaultNativeJwe } from './app-integration';
|
|
8
4
|
import { provider, session as sessionBuilder } from './builders';
|
|
9
5
|
import { getConsentsWaitForAnalytics, getFallbackConsents } from './builders/consent-manager';
|
|
10
|
-
import { applyAdvertisingConsent, applyAdvertisingConsentSync
|
|
6
|
+
import { applyAdvertisingConsent, applyAdvertisingConsentSync } from './builders/consents';
|
|
11
7
|
import { engagementEvent, identityEvent, routableEvent, trackerEvent } from './builders/events';
|
|
12
8
|
import { anonymousEngagementEvent, anonymousTrackerEvent } from './builders/events-anonymous-node';
|
|
13
|
-
import { readSession } from './builders/session-browser';
|
|
14
9
|
import { baseConfig as defaultConfig } from './config';
|
|
15
10
|
import { CISEndpoints, collectorEndpoints, remoteConfig } from './config-browser';
|
|
16
11
|
import defer from './defer';
|
|
@@ -20,11 +15,18 @@ import { addPageLeaveTracking, leaveTrackingIsActive, removePageLeaveTracking, r
|
|
|
20
15
|
import { addTpaasLeaveTracking, getTpaasLeaveObject, leaveTpaasTrackingIsActive, resetTpaasViewedContent, shouldEnableLeaveTracking, trackTpaasActiveLeave, updateTpaasLeaveTracking, updateTpaasViewedContent, } from './leaveTrackingTpaas';
|
|
21
16
|
import send from './network';
|
|
22
17
|
import * as config from './remoteConfig';
|
|
18
|
+
import { generateSessionSDRN, readSession } from './session/store';
|
|
19
|
+
import { buildAnonymousImpressionUIElementEvent, buildCompletedHealthActionEvent, buildEngagementAdEvent, buildEngagementAffiliateEvent, buildEngagementAudioEvent, buildEngagementFormEvent, buildEngagementHealthUIElementEvent, buildEngagementOfferEvent, buildEngagementSchoolUIElementEvent, buildEngagementSportsUIElementEvent, buildEngagementTeaserEvent, buildEngagementTvModuleEvent, buildEngagementTvSearchEvent, buildEngagementUIElementEvent, buildEngagementVideoAdEvent, buildEngagementVideoEvent, buildEngagementWidgetEvent, buildHeartbeatCommercialArticleEvent, buildImpressionAdEvent, buildImpressionAdSlotEvent, buildImpressionAffiliateEvent, buildImpressionFormEvent, buildImpressionHealthUIElementEvent, buildImpressionOfferEvent, buildImpressionPlayerEvent, buildImpressionSchoolUIElementEvent, buildImpressionSportsUIElementEvent, buildImpressionTeaserEvent, buildImpressionUIElementEvent, buildImpressionWidgetEvent, buildLeaveArticleEvent, buildLeaveAudioPageEvent, buildLeaveErrorEvent, buildLeaveFrontpageEvent, buildLeaveLandingpageEvent, buildLeaveListingEvent, buildLeaveLockedArticleEvent, buildLeaveLockedAudioPageEvent, buildLeaveLockedPageEvent, buildLeaveLockedVideoPageEvent, buildLeavePageEvent, buildLeaveSchoolPageEvent, buildLeaveSportsPageEvent, buildLeaveVideoPageEvent, buildLeaveWeatherEvent, buildLoadAdEvent, buildViewArticleEvent, buildViewAudioPageEvent, buildViewErrorEvent, buildViewFrontpageEvent, buildViewHealthPageEvent, buildViewLandingpageEvent, buildViewListingEvent, buildViewLockedArticleEvent, buildViewLockedAudioPageEvent, buildViewLockedPageEvent, buildViewLockedVideoPageEvent, buildViewPageEvent, buildViewSchoolPageEvent, buildViewSportsPageEvent, buildViewTitleEvent, buildViewVideoPageEvent, buildViewWeatherEvent, } from './tpaas-builders';
|
|
20
|
+
import { prepareAnonymousTpaasEventContext, prepareTpaasEventContext } from './tpaas-context';
|
|
21
|
+
import { LeaveArticle, LeaveAudioPage, LeaveError, LeaveFrontpage, LeaveLandingpage, LeaveListing, LeaveLockedArticle, LeaveLockedAudioPage, LeaveLockedPage, LeaveLockedVideoPage, LeavePage, LeaveSchoolPage, LeaveSportsPage, LeaveVideoPage, LeaveWeather, ViewArticle, ViewAudioPage, ViewError, ViewFrontpage, ViewHealthPage, ViewLandingpage, ViewListing, ViewLockedArticle, ViewLockedAudioPage, ViewLockedPage, ViewLockedVideoPage, ViewPage, ViewSportsPage, ViewTitle, ViewVideoPage, ViewWeather, } from './tpaas-schemas';
|
|
23
22
|
import { startProxyProviderListener } from './tracker-proxy/proxy-provider';
|
|
23
|
+
import { evaluateAndFlatten, isBrowser, isFunction, isPromise, omit, pulseMerge, throttle } from './utils';
|
|
24
24
|
import { SDK_VERSION } from './version';
|
|
25
25
|
import { VisibilityObserver } from './visibility-observer';
|
|
26
26
|
import warnOnce from './warnOnce';
|
|
27
27
|
import { buildClickUIElementEvent } from './wrapper/engagement/ui-element/event-builder';
|
|
28
|
+
import { isLegacyPageType } from './wrapper/types';
|
|
29
|
+
import { mapPageToPageRef } from './wrapper/utils/map-page-to-page-ref';
|
|
28
30
|
import { pageFromPageView } from './wrapper/utils/page-from-page-view';
|
|
29
31
|
import { buildLegacyViewArticleEvent } from './wrapper/view/article/event-builder';
|
|
30
32
|
import { buildLegacyViewFrontpageEvent } from './wrapper/view/frontpage/event-builder';
|
|
@@ -60,6 +62,7 @@ const anonymousEvents = {
|
|
|
60
62
|
trackerEvent: anonymousTrackerEvent,
|
|
61
63
|
engagementEvent: anonymousEngagementEvent,
|
|
62
64
|
};
|
|
65
|
+
const ANONYMOUS_EVENT_FORBIDDEN_FIELDS = ['session', 'actor', 'device', 'location', 'pageViewId'];
|
|
63
66
|
/**
|
|
64
67
|
* @typeParam T Type of event to track
|
|
65
68
|
* @param name
|
|
@@ -114,6 +117,32 @@ export function unsubscribe(eventName, callback) {
|
|
|
114
117
|
* @class Tracker
|
|
115
118
|
*/
|
|
116
119
|
export default class Tracker {
|
|
120
|
+
/**
|
|
121
|
+
* What the TPaaS context module reads to resolve the context of an event.
|
|
122
|
+
* Built on every call, so it always reflects the current state.
|
|
123
|
+
*/
|
|
124
|
+
get tpaasContextSource() {
|
|
125
|
+
return {
|
|
126
|
+
state: this.state,
|
|
127
|
+
builders: this.builders,
|
|
128
|
+
currentPage: this.currentPageContext,
|
|
129
|
+
applyRemoteConfig: () => this._applyRemoteConfigEndpoints(),
|
|
130
|
+
syncRemoteResources: (builders) => this.syncRemoteResources(undefined, builders),
|
|
131
|
+
getConsents: () => this.getConsents(),
|
|
132
|
+
onSessionResolved: () => this.resolveSessionIdPromise(),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async getCurrentLegacyPage() {
|
|
136
|
+
const { id, type, url } = await this.currentPageContext.info;
|
|
137
|
+
// make sure the pageType is valid for legacy events
|
|
138
|
+
const validatedType = isLegacyPageType(type) ? type : 'Page';
|
|
139
|
+
return {
|
|
140
|
+
// add the SDRN prefix if it's not there, legacy events expect the full SDRN format
|
|
141
|
+
id: id.startsWith('sdrn:') ? id : `sdrn:${this.state.providerId}:${validatedType.toLowerCase()}:${id}`,
|
|
142
|
+
type: validatedType,
|
|
143
|
+
url,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
117
146
|
/**
|
|
118
147
|
* > [!WARNING]
|
|
119
148
|
* >
|
|
@@ -132,12 +161,37 @@ export default class Tracker {
|
|
|
132
161
|
// the tracking of the same element with both old and new events at the same time
|
|
133
162
|
this.legacyVisibilityObservers = new Map();
|
|
134
163
|
this.visibilityObservers = new Map();
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Current page state shared by legacy and TPaaS tracking. See CurrentPageContext for
|
|
166
|
+
* which properties are shared and which are exclusively TPaaS metadata.
|
|
167
|
+
*/
|
|
168
|
+
this.currentPageContext = {
|
|
169
|
+
info: {
|
|
170
|
+
id: 'unknown',
|
|
171
|
+
type: 'Page',
|
|
172
|
+
url: isBrowser ? window.location.href : undefined,
|
|
173
|
+
},
|
|
174
|
+
referrer: {
|
|
175
|
+
url: isBrowser ? document.referrer || undefined : undefined,
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
this.setCurrentTpaasPageData = ({ id, type, referrer, content, sports, }) => {
|
|
179
|
+
// TPaaS Views replace the context, intentionally resetting omitted content and sports.
|
|
180
|
+
this.currentPageContext = {
|
|
181
|
+
info: {
|
|
182
|
+
id: id || 'unknown',
|
|
183
|
+
type: type || 'Page',
|
|
184
|
+
url: isBrowser ? window.location.href : undefined,
|
|
185
|
+
},
|
|
186
|
+
referrer: {
|
|
187
|
+
...referrer,
|
|
188
|
+
url: referrer?.url ?? (isBrowser ? document.referrer || undefined : undefined),
|
|
189
|
+
},
|
|
190
|
+
// destructure and copy content and sports to avoid mutations from outside
|
|
191
|
+
content: content && { ...content },
|
|
192
|
+
sports: sports && { ...sports },
|
|
193
|
+
};
|
|
139
194
|
};
|
|
140
|
-
this.currentPage = undefined;
|
|
141
195
|
/**
|
|
142
196
|
* Promise that resolves when a session ID becomes available
|
|
143
197
|
* @private
|
|
@@ -149,24 +203,22 @@ export default class Tracker {
|
|
|
149
203
|
*/
|
|
150
204
|
this.hasProxyListener = false;
|
|
151
205
|
this.setPageDefaults = (pageViewEvent) => {
|
|
152
|
-
|
|
206
|
+
// Legacy Views update only the shared properties, preserving TPaaS-only content and sports.
|
|
207
|
+
this.currentPageContext.info = pageFromPageView(pageViewEvent);
|
|
208
|
+
this.currentPageContext.referrer = Promise.resolve(pageViewEvent.origin).then((originProperties) => mapPageToPageRef(originProperties?.id, originProperties?.type, originProperties?.url));
|
|
153
209
|
if (pageViewEvent.origin) {
|
|
154
210
|
const pageDefaults = { origin: pageViewEvent.origin };
|
|
155
211
|
this.update(pageDefaults, true);
|
|
156
212
|
}
|
|
157
213
|
};
|
|
158
|
-
this.setCurrentPage = (id, type) => {
|
|
159
|
-
this.currentPage = {
|
|
160
|
-
pageId: id,
|
|
161
|
-
pageType: type,
|
|
162
|
-
url: isBrowser ? window.location.href : undefined,
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
214
|
logger.setLevel(config?.logLevel ?? logger.levels.ERROR);
|
|
166
215
|
// runtime check for providerId inconsistency
|
|
167
216
|
if (!providerId || !(typeof providerId === 'string')) {
|
|
168
217
|
throw new Error('Required parameter `providerId` missing');
|
|
169
218
|
}
|
|
219
|
+
if (config?.componentVersion !== undefined && config?.component === undefined) {
|
|
220
|
+
throw new Error('`componentVersion` cannot be provided without `component`');
|
|
221
|
+
}
|
|
170
222
|
let includeAdvertising;
|
|
171
223
|
if (isBrowser && config?.autoCreateConsents) {
|
|
172
224
|
config.consents = getConsentsWaitForAnalytics((consents) => {
|
|
@@ -205,11 +257,15 @@ export default class Tracker {
|
|
|
205
257
|
tpaasCollectorBaseUrl: collectorEndpoints[deployStageTpaas],
|
|
206
258
|
trackerId: v4(),
|
|
207
259
|
vendors: config?.vendors?.length ? [] : ['xandr'],
|
|
260
|
+
useBeacon: true,
|
|
261
|
+
useBeaconWhenAvailable: true,
|
|
208
262
|
}, config);
|
|
209
263
|
// Move to default config?
|
|
210
264
|
this.builders = pulseMerge({}, builders, {
|
|
211
265
|
provider: {
|
|
212
266
|
id: providerId,
|
|
267
|
+
...(config?.component !== undefined && { component: config.component }),
|
|
268
|
+
...(config?.componentVersion !== undefined && { componentVersion: config.componentVersion }),
|
|
213
269
|
},
|
|
214
270
|
tracker: {
|
|
215
271
|
version: SDK_VERSION,
|
|
@@ -326,6 +382,11 @@ export default class Tracker {
|
|
|
326
382
|
return queuedEvent.then((result) => result);
|
|
327
383
|
});
|
|
328
384
|
};
|
|
385
|
+
/*
|
|
386
|
+
* Casting `input` as `Partial<Builders>` to formalise the intention of processing the event input in relation to the properties in
|
|
387
|
+
* the Builders type. It would justify changing the public api for `.track`, but as this deals with legacy code, we
|
|
388
|
+
* keep it internal, so dependencies from now on can count on objects being a Partial<Builder>
|
|
389
|
+
*/
|
|
329
390
|
return this.syncRemoteResources(input, currentBuilders).then(_track, _track);
|
|
330
391
|
}
|
|
331
392
|
/**
|
|
@@ -358,11 +419,11 @@ export default class Tracker {
|
|
|
358
419
|
*/
|
|
359
420
|
async trackAnonymous(eventType, input, options) {
|
|
360
421
|
// We must create the event as soon as possible, as it defines the creationDate.
|
|
361
|
-
const newEvent = this.createAnonymousEvent(input);
|
|
422
|
+
const newEvent = omit(this.createAnonymousEvent(input), ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
362
423
|
// Remote config values ----------------
|
|
363
424
|
await this._applyRemoteConfigEndpoints();
|
|
364
425
|
// Resolve all available properties ----------------
|
|
365
|
-
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.
|
|
426
|
+
const resolvedOutput = await Promise.all([this.resolveTrackInput(newEvent), this.resolveAnonymousTrackGlobals()]);
|
|
366
427
|
let eventOutput = resolvedOutput.reduce((acc, p) => pulseMerge(acc, p), {});
|
|
367
428
|
eventOutput = this.applyAnonymousEventTypeDefaults(eventOutput, eventType);
|
|
368
429
|
// Leave Events ----------------
|
|
@@ -376,6 +437,7 @@ export default class Tracker {
|
|
|
376
437
|
eventInput: eventOutput,
|
|
377
438
|
sdkConfig: this.state,
|
|
378
439
|
});
|
|
440
|
+
eventOutput = omit(eventOutput, ANONYMOUS_EVENT_FORBIDDEN_FIELDS);
|
|
379
441
|
if (options?.bookmarkKey) {
|
|
380
442
|
this.bookmark.set(options.bookmarkKey, eventOutput);
|
|
381
443
|
}
|
|
@@ -390,132 +452,6 @@ export default class Tracker {
|
|
|
390
452
|
await this.sendAnonymous();
|
|
391
453
|
return queuedEvent;
|
|
392
454
|
}
|
|
393
|
-
async adaptExperiments(baseExperiments = []) {
|
|
394
|
-
return baseExperiments.map((exp) => {
|
|
395
|
-
return {
|
|
396
|
-
name: exp.name || exp.id,
|
|
397
|
-
variant: exp.variant || '',
|
|
398
|
-
};
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
*
|
|
403
|
-
* @private
|
|
404
|
-
* @category TPaaS Tracking
|
|
405
|
-
*/
|
|
406
|
-
async prepareAnonymousTpaasEvent() {
|
|
407
|
-
try {
|
|
408
|
-
await this._applyRemoteConfigEndpoints();
|
|
409
|
-
}
|
|
410
|
-
catch (ex) {
|
|
411
|
-
logger.trace('Failed to sync remote config', ex);
|
|
412
|
-
}
|
|
413
|
-
return {
|
|
414
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
415
|
-
version: SDK_VERSION,
|
|
416
|
-
isHybrid: !!this.state.isHybrid,
|
|
417
|
-
pageviewId: this.state.pageViewId,
|
|
418
|
-
providerId: this.state.providerId,
|
|
419
|
-
experiments: await this.adaptExperiments(this.builders.experiments),
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
*
|
|
424
|
-
* @private
|
|
425
|
-
* @category TPaaS Tracking
|
|
426
|
-
*/
|
|
427
|
-
async prepareTpaasEvent() {
|
|
428
|
-
try {
|
|
429
|
-
await this.syncRemoteResources(undefined, { ...this.builders });
|
|
430
|
-
}
|
|
431
|
-
catch (ex) {
|
|
432
|
-
logger.trace('Failed to sync remote resources', ex);
|
|
433
|
-
// remote config and CIS failures are also ignored for the old track() method. doing the same here
|
|
434
|
-
}
|
|
435
|
-
function adaptActorToNewFormat(actor) {
|
|
436
|
-
// this is a temporary solution to adapt the actor to the new format
|
|
437
|
-
// it should be removed once we have new methods in place to get the actor
|
|
438
|
-
if (!actor) {
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
return {
|
|
442
|
-
id: actor.id?.toString() || '',
|
|
443
|
-
realm: actor.realm || '',
|
|
444
|
-
hasAnySubscription: !!actor.hasAnySubscription,
|
|
445
|
-
region: isString(actor.region) ? actor.region : undefined,
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
function adaptConsentsToNewFormat(consents) {
|
|
449
|
-
if (!consents) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
const { purposes, source } = consents;
|
|
453
|
-
const { CMP_ADVERTISING, CMP_ANALYTICS, CMP_MARKETING, CMP_PERSONALIZATION } = purposes;
|
|
454
|
-
function adaptStatusOrOptIn({ status, optIn }) {
|
|
455
|
-
// doing an unnecessary check for status here
|
|
456
|
-
// because otherwise the code after the switch will be marked as unreachable in the IDE
|
|
457
|
-
if (status) {
|
|
458
|
-
switch (status) {
|
|
459
|
-
case 'accepted':
|
|
460
|
-
return 'Accepted';
|
|
461
|
-
case 'rejected':
|
|
462
|
-
return 'Rejected';
|
|
463
|
-
case 'unknown':
|
|
464
|
-
return 'Unknown';
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
if (optIn === true) {
|
|
468
|
-
return 'Accepted';
|
|
469
|
-
}
|
|
470
|
-
if (optIn === false) {
|
|
471
|
-
return 'Rejected';
|
|
472
|
-
}
|
|
473
|
-
return 'Unknown';
|
|
474
|
-
}
|
|
475
|
-
return {
|
|
476
|
-
advertising: adaptStatusOrOptIn(CMP_ADVERTISING),
|
|
477
|
-
analytics: adaptStatusOrOptIn(CMP_ANALYTICS),
|
|
478
|
-
marketing: adaptStatusOrOptIn(CMP_MARKETING),
|
|
479
|
-
personalization: adaptStatusOrOptIn(CMP_PERSONALIZATION),
|
|
480
|
-
source: source || 'unknown',
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
const [actor, consents, experiments] = await Promise.all([
|
|
484
|
-
this.getActor(),
|
|
485
|
-
this.getConsents(),
|
|
486
|
-
this.adaptExperiments(this.builders.experiments),
|
|
487
|
-
]);
|
|
488
|
-
const { environmentId, jwe } = parsePulseCookies();
|
|
489
|
-
return {
|
|
490
|
-
autoTrackerVersion: this.builders.tracker?.autoTrackerVersion,
|
|
491
|
-
version: SDK_VERSION,
|
|
492
|
-
isHybrid: !!this.state.isHybrid,
|
|
493
|
-
user: adaptActorToNewFormat(actor),
|
|
494
|
-
consents: adaptConsentsToNewFormat(consents),
|
|
495
|
-
providerId: this.state.providerId,
|
|
496
|
-
pageviewId: this.state.pageViewId,
|
|
497
|
-
currentPage: this.currentPage,
|
|
498
|
-
experiments,
|
|
499
|
-
environmentId,
|
|
500
|
-
jwe,
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Generate a generic TPaaS event with common builders output
|
|
505
|
-
* The method should be used for experiments, not for real production work.
|
|
506
|
-
* It doesn't have any real TPaaS schema associated with it.
|
|
507
|
-
* The method doesn't queue or send the event, it just returns the merged object.
|
|
508
|
-
* The method can be removed at any time in the future, so use it with caution.
|
|
509
|
-
*
|
|
510
|
-
* @param input - The input object to merge with the common builders output
|
|
511
|
-
* @returns A promise that resolves to the merged object
|
|
512
|
-
* @private
|
|
513
|
-
* @category TPaaS Tracking
|
|
514
|
-
*/
|
|
515
|
-
async generateGenericTpaasEvent(input) {
|
|
516
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
517
|
-
return pulseMerge({}, input, getCommonBuildersOutput(new Date(), dependencies));
|
|
518
|
-
}
|
|
519
455
|
/**
|
|
520
456
|
* This method extends the list of base experiments that will be automatically included in every event sent by the tracker.
|
|
521
457
|
*
|
|
@@ -537,6 +473,9 @@ export default class Tracker {
|
|
|
537
473
|
* @category Tracking
|
|
538
474
|
*/
|
|
539
475
|
addExperiments(experiments) {
|
|
476
|
+
if (experiments.some((experiment) => experiment.id.startsWith('sdrn:'))) {
|
|
477
|
+
logger.warn('Pulse - addExperiments received an experiment id starting with "sdrn:"; pass the raw experiment id instead. The SDK will generate the sdrn automatically.');
|
|
478
|
+
}
|
|
540
479
|
this.update({ experiments }, true);
|
|
541
480
|
}
|
|
542
481
|
/**
|
|
@@ -571,7 +510,7 @@ export default class Tracker {
|
|
|
571
510
|
const viewUIElementInputProperties = buildEventFromElement(element);
|
|
572
511
|
this.trackLegacyViewUIElement(viewUIElementInputProperties);
|
|
573
512
|
}));
|
|
574
|
-
this.legacyVisibilityObservers.get(selector)?.observe(selector);
|
|
513
|
+
this.legacyVisibilityObservers.get(selector)?.observe(selector, {});
|
|
575
514
|
}
|
|
576
515
|
/**
|
|
577
516
|
* The `addUIElementVisibilityTracking` function provides an interface for sending tracking events when specific UI elements become visible within the viewport.
|
|
@@ -603,7 +542,38 @@ export default class Tracker {
|
|
|
603
542
|
const eventInput = buildEventFromElement(element);
|
|
604
543
|
this.trackImpressionUIElement(eventInput);
|
|
605
544
|
}));
|
|
606
|
-
this.visibilityObservers.get(selector)?.observe(selector);
|
|
545
|
+
this.visibilityObservers.get(selector)?.observe(selector, {});
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* The `addElementVisibilityObserver` function provides an interface for executing arbitrary code when specific DOM Elements become visible within the viewport.
|
|
549
|
+
* It is built on the `VisibilityObserver` class, which efficiently detects visibility changes in DOM elements.
|
|
550
|
+
* When an element becomes at least 2/3 visible, a callback is triggered, with the Element that invoked the callback call as argument.
|
|
551
|
+
* It leverages the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) for viewport tracking
|
|
552
|
+
* and the [Mutation Observer API](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) to monitor lazy-loaded elements.
|
|
553
|
+
*
|
|
554
|
+
* Example usage:
|
|
555
|
+
*
|
|
556
|
+
* ```ts
|
|
557
|
+
* tracker.addElementVisibilityObserver('[data-pulse-entity-id]', (element) => {
|
|
558
|
+
* const eventInput = parseElementIntoEventInput(element); // user-defined function
|
|
559
|
+
* tracker.trackImpressionTeaser(eventInput); // can be anything actually, not necessarily a Teaser tracking call
|
|
560
|
+
* });
|
|
561
|
+
* ```
|
|
562
|
+
* @param selector
|
|
563
|
+
* @param callback
|
|
564
|
+
* @param options {ObserverOptions}
|
|
565
|
+
* @param options.threshold - A number between 0 and 1 indicating how much of the element should be visible to trigger
|
|
566
|
+
* the callback. Default is 0.67 (2/3 of the element).
|
|
567
|
+
*/
|
|
568
|
+
addElementVisibilityObserver(selector, callback, options = {}) {
|
|
569
|
+
if (this.visibilityObservers.has(selector)) {
|
|
570
|
+
console.warn(`Cannot add UI Element visibility tracking for selector "${selector}" as it is already being tracked.`);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
this.visibilityObservers.set(selector, new VisibilityObserver((element) => {
|
|
574
|
+
callback(element);
|
|
575
|
+
}));
|
|
576
|
+
this.visibilityObservers.get(selector)?.observe(selector, options);
|
|
607
577
|
}
|
|
608
578
|
/**
|
|
609
579
|
* The old trackViewArticle method from the Media Wrapper.
|
|
@@ -697,7 +667,7 @@ export default class Tracker {
|
|
|
697
667
|
* @category Legacy Tracking
|
|
698
668
|
*/
|
|
699
669
|
trackLegacyViewUIElement(inputProperties, trackOptions) {
|
|
700
|
-
const viewUIElementEventData = buildLegacyViewUIElementEvent(inputProperties, this.
|
|
670
|
+
const viewUIElementEventData = buildLegacyViewUIElementEvent(inputProperties, this.getCurrentLegacyPage());
|
|
701
671
|
return this.track('trackerEvent', viewUIElementEventData, trackOptions);
|
|
702
672
|
}
|
|
703
673
|
/**
|
|
@@ -708,7 +678,7 @@ export default class Tracker {
|
|
|
708
678
|
* @category Legacy Tracking
|
|
709
679
|
*/
|
|
710
680
|
trackLegacyClickUIElement(inputProperties, trackOptions) {
|
|
711
|
-
const clickUIElementEventData = buildClickUIElementEvent(inputProperties, this.
|
|
681
|
+
const clickUIElementEventData = buildClickUIElementEvent(inputProperties, this.getCurrentLegacyPage());
|
|
712
682
|
return this.track('trackerEvent', clickUIElementEventData, trackOptions);
|
|
713
683
|
}
|
|
714
684
|
/**
|
|
@@ -718,36 +688,39 @@ export default class Tracker {
|
|
|
718
688
|
* @param input
|
|
719
689
|
* @category TPaaS Tracking
|
|
720
690
|
*/
|
|
721
|
-
async
|
|
722
|
-
const
|
|
723
|
-
const event =
|
|
691
|
+
async trackAnonymousImpressionUIElement(input) {
|
|
692
|
+
const context = await prepareAnonymousTpaasEventContext(this.tpaasContextSource, input);
|
|
693
|
+
const event = buildAnonymousImpressionUIElementEvent(context);
|
|
724
694
|
return this.sendTpaasEvent(event);
|
|
725
695
|
}
|
|
726
696
|
async trackCompletedHealthAction(input) {
|
|
727
|
-
const
|
|
728
|
-
const event = buildCompletedHealthActionEvent(
|
|
697
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
698
|
+
const event = buildCompletedHealthActionEvent(context);
|
|
729
699
|
return this.sendTpaasEvent(event);
|
|
730
700
|
}
|
|
731
701
|
async trackEngagementHealthUIElement(input) {
|
|
732
|
-
const
|
|
733
|
-
const event = buildEngagementHealthUIElementEvent(
|
|
702
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
703
|
+
const event = buildEngagementHealthUIElementEvent(context);
|
|
734
704
|
return this.sendTpaasEvent(event);
|
|
735
705
|
}
|
|
736
706
|
async trackViewHealthPage(input, options) {
|
|
737
707
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
738
|
-
this.
|
|
739
|
-
|
|
740
|
-
|
|
708
|
+
this.setCurrentTpaasPageData({
|
|
709
|
+
id: input.object.objectId,
|
|
710
|
+
type: ViewHealthPage.object.objectType,
|
|
711
|
+
referrer: input.page?.referrer,
|
|
712
|
+
});
|
|
713
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
714
|
+
const event = buildViewHealthPageEvent(context);
|
|
741
715
|
const result = this.sendTpaasEvent(event);
|
|
742
716
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
this.trackLeavePage({
|
|
717
|
+
const leavePageCallback = async (leave) => {
|
|
718
|
+
// HealthView Page is a bit special, in the sense that in doesn't have a dedicated Leave event.
|
|
719
|
+
// Instead, we need to reuse the generic Leave Page event, but adapt the input accordingly.
|
|
720
|
+
// This means omitting some fields from HealthView Page that are not part of Leave Page schema.
|
|
721
|
+
const { experiments, metrics, object, origin, userHealthData, ...restInput } = context.input;
|
|
722
|
+
const { category, custom, name, tags, food, physicalActivity, training, ...restObject } = context.input.object;
|
|
723
|
+
await this.trackLeavePage({
|
|
751
724
|
leave,
|
|
752
725
|
...restInput,
|
|
753
726
|
object: {
|
|
@@ -757,10 +730,7 @@ export default class Tracker {
|
|
|
757
730
|
});
|
|
758
731
|
};
|
|
759
732
|
addTpaasLeaveTracking({
|
|
760
|
-
|
|
761
|
-
pageElement,
|
|
762
|
-
objectResizable,
|
|
763
|
-
heightBuilder,
|
|
733
|
+
...options.leaveTracking,
|
|
764
734
|
schema: LeavePage.object.objectType,
|
|
765
735
|
trackMethod: leavePageCallback,
|
|
766
736
|
});
|
|
@@ -768,8 +738,8 @@ export default class Tracker {
|
|
|
768
738
|
return result;
|
|
769
739
|
}
|
|
770
740
|
async trackImpressionHealthUIElement(input) {
|
|
771
|
-
const
|
|
772
|
-
const event = buildImpressionHealthUIElementEvent(
|
|
741
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
742
|
+
const event = buildImpressionHealthUIElementEvent(context);
|
|
773
743
|
return this.sendTpaasEvent(event);
|
|
774
744
|
}
|
|
775
745
|
/**
|
|
@@ -779,23 +749,23 @@ export default class Tracker {
|
|
|
779
749
|
*/
|
|
780
750
|
async trackViewPage(input, options) {
|
|
781
751
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
782
|
-
this.
|
|
783
|
-
|
|
784
|
-
|
|
752
|
+
this.setCurrentTpaasPageData({
|
|
753
|
+
id: input.object.objectId,
|
|
754
|
+
type: ViewPage.object.objectType,
|
|
755
|
+
referrer: input.page?.referrer,
|
|
756
|
+
});
|
|
757
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
758
|
+
const event = buildViewPageEvent(context);
|
|
785
759
|
const result = this.sendTpaasEvent(event);
|
|
786
760
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
this.trackLeavePage({
|
|
761
|
+
const leavePageCallback = async (leave) => {
|
|
762
|
+
await this.trackLeavePage({
|
|
790
763
|
leave,
|
|
791
|
-
...input,
|
|
764
|
+
...context.input,
|
|
792
765
|
});
|
|
793
766
|
};
|
|
794
767
|
addTpaasLeaveTracking({
|
|
795
|
-
|
|
796
|
-
pageElement,
|
|
797
|
-
objectResizable,
|
|
798
|
-
heightBuilder,
|
|
768
|
+
...options.leaveTracking,
|
|
799
769
|
schema: LeavePage.object.objectType,
|
|
800
770
|
trackMethod: leavePageCallback,
|
|
801
771
|
});
|
|
@@ -809,38 +779,79 @@ export default class Tracker {
|
|
|
809
779
|
*/
|
|
810
780
|
async trackViewSportsPage(input, options) {
|
|
811
781
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
812
|
-
this.
|
|
813
|
-
|
|
814
|
-
|
|
782
|
+
this.setCurrentTpaasPageData({
|
|
783
|
+
id: input.object.objectId,
|
|
784
|
+
type: ViewSportsPage.object.objectType,
|
|
785
|
+
referrer: input.page?.referrer,
|
|
786
|
+
sports: {
|
|
787
|
+
sportName: input.object.sportName,
|
|
788
|
+
sportSubview: input.object.sportSubview,
|
|
789
|
+
sportView: input.object.sportView,
|
|
790
|
+
sports: input.object.sports,
|
|
791
|
+
},
|
|
792
|
+
});
|
|
793
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
794
|
+
const event = buildViewSportsPageEvent(context);
|
|
815
795
|
const result = this.sendTpaasEvent(event);
|
|
816
796
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
this.trackLeaveSportsPage({
|
|
797
|
+
const leaveSportsPageCallback = async (leave) => {
|
|
798
|
+
await this.trackLeaveSportsPage({
|
|
820
799
|
leave,
|
|
821
|
-
...input,
|
|
800
|
+
...context.input,
|
|
822
801
|
});
|
|
823
802
|
};
|
|
824
803
|
addTpaasLeaveTracking({
|
|
825
|
-
|
|
826
|
-
pageElement,
|
|
827
|
-
objectResizable,
|
|
828
|
-
heightBuilder,
|
|
804
|
+
...options.leaveTracking,
|
|
829
805
|
schema: LeaveSportsPage.object.objectType,
|
|
830
806
|
trackMethod: leaveSportsPageCallback,
|
|
831
807
|
});
|
|
832
808
|
}
|
|
833
809
|
return result;
|
|
834
810
|
}
|
|
811
|
+
/**
|
|
812
|
+
* @param input
|
|
813
|
+
* @param options
|
|
814
|
+
* @category TPaaS Tracking
|
|
815
|
+
*/
|
|
816
|
+
async trackViewSchoolPage(input, options) {
|
|
817
|
+
this.newPageView();
|
|
818
|
+
// TODO: SchoolPage is not currently part of the catalog's PageRef.pageType enum.
|
|
819
|
+
this.setCurrentTpaasPageData({
|
|
820
|
+
id: input.object.objectId,
|
|
821
|
+
type: 'Page',
|
|
822
|
+
referrer: input.page?.referrer,
|
|
823
|
+
});
|
|
824
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
825
|
+
const event = buildViewSchoolPageEvent(context);
|
|
826
|
+
const result = this.sendTpaasEvent(event);
|
|
827
|
+
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
828
|
+
const leaveSchoolPageCallback = async (leave) => {
|
|
829
|
+
await this.trackLeaveSchoolPage({
|
|
830
|
+
leave,
|
|
831
|
+
...context.input,
|
|
832
|
+
});
|
|
833
|
+
};
|
|
834
|
+
addTpaasLeaveTracking({
|
|
835
|
+
...options.leaveTracking,
|
|
836
|
+
schema: LeaveSchoolPage.object.objectType,
|
|
837
|
+
trackMethod: leaveSchoolPageCallback,
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
return result;
|
|
841
|
+
}
|
|
835
842
|
/**
|
|
836
843
|
* @param input
|
|
837
844
|
* @category TPaaS Tracking
|
|
838
845
|
*/
|
|
839
846
|
async trackViewTitle(input) {
|
|
840
847
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
841
|
-
this.
|
|
842
|
-
|
|
843
|
-
|
|
848
|
+
this.setCurrentTpaasPageData({
|
|
849
|
+
id: input.object.objectId,
|
|
850
|
+
type: ViewTitle.object.objectType,
|
|
851
|
+
referrer: input.page?.referrer,
|
|
852
|
+
});
|
|
853
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
854
|
+
const event = buildViewTitleEvent(context);
|
|
844
855
|
return this.sendTpaasEvent(event);
|
|
845
856
|
// there's no Leave Title event
|
|
846
857
|
}
|
|
@@ -849,17 +860,17 @@ export default class Tracker {
|
|
|
849
860
|
* @category TPaaS Tracking
|
|
850
861
|
*/
|
|
851
862
|
async trackImpressionWidget(input) {
|
|
852
|
-
const
|
|
853
|
-
const event = buildImpressionWidgetEvent(
|
|
863
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
864
|
+
const event = buildImpressionWidgetEvent(context);
|
|
854
865
|
return this.sendTpaasEvent(event);
|
|
855
866
|
}
|
|
856
867
|
/**
|
|
857
868
|
* @param input
|
|
858
869
|
* @category TPaaS Tracking
|
|
859
870
|
*/
|
|
860
|
-
async
|
|
861
|
-
const
|
|
862
|
-
const event =
|
|
871
|
+
async trackLoadAd(input) {
|
|
872
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
873
|
+
const event = buildLoadAdEvent(context);
|
|
863
874
|
return this.sendTpaasEvent(event);
|
|
864
875
|
}
|
|
865
876
|
/**
|
|
@@ -869,41 +880,30 @@ export default class Tracker {
|
|
|
869
880
|
*/
|
|
870
881
|
async trackViewArticle(input, options) {
|
|
871
882
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
872
|
-
this.
|
|
873
|
-
|
|
874
|
-
|
|
883
|
+
this.setCurrentTpaasPageData({
|
|
884
|
+
id: input.object.objectId,
|
|
885
|
+
type: ViewArticle.object.objectType,
|
|
886
|
+
referrer: input.page?.referrer,
|
|
887
|
+
content: input.page?.content,
|
|
888
|
+
});
|
|
889
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
890
|
+
const event = buildViewArticleEvent(context);
|
|
875
891
|
const result = this.sendTpaasEvent(event);
|
|
876
892
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
this.trackLeaveArticle({
|
|
893
|
+
const leaveArticleCallback = async (leave) => {
|
|
894
|
+
await this.trackLeaveArticle({
|
|
880
895
|
leave,
|
|
881
|
-
...input,
|
|
896
|
+
...context.input,
|
|
882
897
|
});
|
|
883
898
|
};
|
|
884
899
|
addTpaasLeaveTracking({
|
|
885
|
-
|
|
886
|
-
pageElement,
|
|
887
|
-
heightBuilder,
|
|
888
|
-
objectResizable,
|
|
900
|
+
...options.leaveTracking,
|
|
889
901
|
schema: LeaveArticle.object.objectType,
|
|
890
902
|
trackMethod: leaveArticleCallback,
|
|
891
903
|
});
|
|
892
904
|
}
|
|
893
905
|
return result;
|
|
894
906
|
}
|
|
895
|
-
/**
|
|
896
|
-
* @param input
|
|
897
|
-
* @param options
|
|
898
|
-
* @category TPaaS Tracking
|
|
899
|
-
*/
|
|
900
|
-
async trackViewAudio(input) {
|
|
901
|
-
// despite the View event type, this is not a page view event, but rather a media object view event
|
|
902
|
-
// so we shouldn't reset the page view ID here or enable leave tracking
|
|
903
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
904
|
-
const event = buildViewAudioEvent(input, dependencies);
|
|
905
|
-
return this.sendTpaasEvent(event);
|
|
906
|
-
}
|
|
907
907
|
/**
|
|
908
908
|
* Tracks a View AudioPage event and automatically fires a Leave AudioPage event when the user
|
|
909
909
|
* navigates away.
|
|
@@ -946,34 +946,36 @@ export default class Tracker {
|
|
|
946
946
|
*/
|
|
947
947
|
async trackViewAudioPage(input, options) {
|
|
948
948
|
this.newPageView();
|
|
949
|
-
this.
|
|
950
|
-
|
|
951
|
-
|
|
949
|
+
this.setCurrentTpaasPageData({
|
|
950
|
+
id: input.object.objectId,
|
|
951
|
+
type: ViewAudioPage.object.objectType,
|
|
952
|
+
referrer: input.page?.referrer,
|
|
953
|
+
content: input.page?.content,
|
|
954
|
+
});
|
|
955
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
956
|
+
const event = buildViewAudioPageEvent(context);
|
|
952
957
|
const result = this.sendTpaasEvent(event);
|
|
953
958
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
954
|
-
const {
|
|
955
|
-
const leaveAudioPageCallback = (leave) => {
|
|
959
|
+
const { leaveAudioBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
|
|
960
|
+
const leaveAudioPageCallback = async (leave) => {
|
|
956
961
|
const leaveAudioInput = leaveAudioBuilder?.() ?? {
|
|
957
962
|
audioCompleted: 0,
|
|
958
963
|
audioStarted: 0,
|
|
959
964
|
maxPlaylistPosition: 0,
|
|
960
965
|
playlistPositionPercentage: 0,
|
|
961
966
|
};
|
|
962
|
-
this.trackLeaveAudioPage({
|
|
967
|
+
await this.trackLeaveAudioPage({
|
|
963
968
|
leave,
|
|
964
969
|
leaveAudio: {
|
|
965
970
|
...leaveAudioInput,
|
|
966
971
|
activityDurationMs: leave.activityDurationMs,
|
|
967
972
|
durationMs: leave.durationMs,
|
|
968
973
|
},
|
|
969
|
-
...input,
|
|
974
|
+
...context.input,
|
|
970
975
|
});
|
|
971
976
|
};
|
|
972
977
|
addTpaasLeaveTracking({
|
|
973
|
-
|
|
974
|
-
pageElement,
|
|
975
|
-
heightBuilder,
|
|
976
|
-
objectResizable,
|
|
978
|
+
...restLeaveTrackingOptions,
|
|
977
979
|
schema: LeaveAudioPage.object.objectType,
|
|
978
980
|
trackMethod: leaveAudioPageCallback,
|
|
979
981
|
});
|
|
@@ -987,36 +989,63 @@ export default class Tracker {
|
|
|
987
989
|
*/
|
|
988
990
|
async trackViewError(input, options) {
|
|
989
991
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
990
|
-
this.
|
|
991
|
-
|
|
992
|
-
|
|
992
|
+
this.setCurrentTpaasPageData({
|
|
993
|
+
id: input.object.objectId,
|
|
994
|
+
type: ViewError.object.objectType,
|
|
995
|
+
referrer: input.page?.referrer,
|
|
996
|
+
});
|
|
997
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
998
|
+
const event = buildViewErrorEvent(context);
|
|
993
999
|
const result = this.sendTpaasEvent(event);
|
|
994
1000
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
this.trackLeaveError({
|
|
1001
|
+
const leaveErrorCallback = async (leave) => {
|
|
1002
|
+
await this.trackLeaveError({
|
|
998
1003
|
leave,
|
|
999
|
-
...input,
|
|
1004
|
+
...context.input,
|
|
1000
1005
|
});
|
|
1001
1006
|
};
|
|
1002
1007
|
addTpaasLeaveTracking({
|
|
1003
|
-
|
|
1004
|
-
pageElement,
|
|
1005
|
-
heightBuilder,
|
|
1006
|
-
objectResizable,
|
|
1008
|
+
...options.leaveTracking,
|
|
1007
1009
|
schema: LeaveError.object.objectType,
|
|
1008
1010
|
trackMethod: leaveErrorCallback,
|
|
1009
1011
|
});
|
|
1010
1012
|
}
|
|
1011
1013
|
return result;
|
|
1012
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* @param input
|
|
1017
|
+
* @category TPaaS Tracking
|
|
1018
|
+
*/
|
|
1019
|
+
async trackImpressionAd(input) {
|
|
1020
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1021
|
+
const event = buildImpressionAdEvent(context);
|
|
1022
|
+
return this.sendTpaasEvent(event);
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* @param input
|
|
1026
|
+
* @category TPaaS Tracking
|
|
1027
|
+
*/
|
|
1028
|
+
async trackImpressionAdSlot(input) {
|
|
1029
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1030
|
+
const event = buildImpressionAdSlotEvent(context);
|
|
1031
|
+
return this.sendTpaasEvent(event);
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* @param input
|
|
1035
|
+
* @category TPaaS Tracking
|
|
1036
|
+
*/
|
|
1037
|
+
async trackImpressionAffiliate(input) {
|
|
1038
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1039
|
+
const event = buildImpressionAffiliateEvent(context);
|
|
1040
|
+
return this.sendTpaasEvent(event);
|
|
1041
|
+
}
|
|
1013
1042
|
/**
|
|
1014
1043
|
* @param input
|
|
1015
1044
|
* @category TPaaS Tracking
|
|
1016
1045
|
*/
|
|
1017
1046
|
async trackImpressionForm(input) {
|
|
1018
|
-
const
|
|
1019
|
-
const event = buildImpressionFormEvent(
|
|
1047
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1048
|
+
const event = buildImpressionFormEvent(context);
|
|
1020
1049
|
return this.sendTpaasEvent(event);
|
|
1021
1050
|
}
|
|
1022
1051
|
/**
|
|
@@ -1024,8 +1053,8 @@ export default class Tracker {
|
|
|
1024
1053
|
* @category TPaaS Tracking
|
|
1025
1054
|
*/
|
|
1026
1055
|
async trackImpressionOffer(input) {
|
|
1027
|
-
const
|
|
1028
|
-
const event = buildImpressionOfferEvent(
|
|
1056
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1057
|
+
const event = buildImpressionOfferEvent(context);
|
|
1029
1058
|
return this.sendTpaasEvent(event);
|
|
1030
1059
|
}
|
|
1031
1060
|
/**
|
|
@@ -1033,8 +1062,26 @@ export default class Tracker {
|
|
|
1033
1062
|
* @category TPaaS Tracking
|
|
1034
1063
|
*/
|
|
1035
1064
|
async trackImpressionPlayer(input) {
|
|
1036
|
-
const
|
|
1037
|
-
const event = buildImpressionPlayerEvent(
|
|
1065
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1066
|
+
const event = buildImpressionPlayerEvent(context);
|
|
1067
|
+
return this.sendTpaasEvent(event);
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* @param input
|
|
1071
|
+
* @category TPaaS Tracking
|
|
1072
|
+
*/
|
|
1073
|
+
async trackImpressionSportsUIElement(input) {
|
|
1074
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1075
|
+
const event = buildImpressionSportsUIElementEvent(context);
|
|
1076
|
+
return this.sendTpaasEvent(event);
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* @param input
|
|
1080
|
+
* @category TPaaS Tracking
|
|
1081
|
+
*/
|
|
1082
|
+
async trackImpressionSchoolUIElement(input) {
|
|
1083
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1084
|
+
const event = buildImpressionSchoolUIElementEvent(context);
|
|
1038
1085
|
return this.sendTpaasEvent(event);
|
|
1039
1086
|
}
|
|
1040
1087
|
/**
|
|
@@ -1042,8 +1089,8 @@ export default class Tracker {
|
|
|
1042
1089
|
* @category TPaaS Tracking
|
|
1043
1090
|
*/
|
|
1044
1091
|
async trackImpressionTeaser(input) {
|
|
1045
|
-
const
|
|
1046
|
-
const event = buildImpressionTeaserEvent(
|
|
1092
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1093
|
+
const event = buildImpressionTeaserEvent(context);
|
|
1047
1094
|
return this.sendTpaasEvent(event);
|
|
1048
1095
|
}
|
|
1049
1096
|
/**
|
|
@@ -1051,8 +1098,8 @@ export default class Tracker {
|
|
|
1051
1098
|
* @category TPaaS Tracking
|
|
1052
1099
|
*/
|
|
1053
1100
|
async trackImpressionUIElement(input) {
|
|
1054
|
-
const
|
|
1055
|
-
const event = buildImpressionUIElementEvent(
|
|
1101
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1102
|
+
const event = buildImpressionUIElementEvent(context);
|
|
1056
1103
|
return this.sendTpaasEvent(event);
|
|
1057
1104
|
}
|
|
1058
1105
|
/**
|
|
@@ -1062,23 +1109,23 @@ export default class Tracker {
|
|
|
1062
1109
|
*/
|
|
1063
1110
|
async trackViewFrontpage(input, options) {
|
|
1064
1111
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1065
|
-
this.
|
|
1066
|
-
|
|
1067
|
-
|
|
1112
|
+
this.setCurrentTpaasPageData({
|
|
1113
|
+
id: input.object.objectId,
|
|
1114
|
+
type: ViewFrontpage.object.objectType,
|
|
1115
|
+
referrer: input.page?.referrer,
|
|
1116
|
+
});
|
|
1117
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1118
|
+
const event = buildViewFrontpageEvent(context);
|
|
1068
1119
|
const result = this.sendTpaasEvent(event);
|
|
1069
1120
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
this.trackLeaveFrontpage({
|
|
1121
|
+
const leaveFrontpageCallback = async (leave) => {
|
|
1122
|
+
await this.trackLeaveFrontpage({
|
|
1073
1123
|
leave,
|
|
1074
|
-
...input,
|
|
1124
|
+
...context.input,
|
|
1075
1125
|
});
|
|
1076
1126
|
};
|
|
1077
1127
|
addTpaasLeaveTracking({
|
|
1078
|
-
|
|
1079
|
-
pageElement,
|
|
1080
|
-
objectResizable,
|
|
1081
|
-
heightBuilder,
|
|
1128
|
+
...options.leaveTracking,
|
|
1082
1129
|
schema: LeaveFrontpage.object.objectType,
|
|
1083
1130
|
trackMethod: leaveFrontpageCallback,
|
|
1084
1131
|
});
|
|
@@ -1092,23 +1139,23 @@ export default class Tracker {
|
|
|
1092
1139
|
*/
|
|
1093
1140
|
async trackViewLandingpage(input, options) {
|
|
1094
1141
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1095
|
-
this.
|
|
1096
|
-
|
|
1097
|
-
|
|
1142
|
+
this.setCurrentTpaasPageData({
|
|
1143
|
+
id: input.object.objectId,
|
|
1144
|
+
type: ViewLandingpage.object.objectType,
|
|
1145
|
+
referrer: input.page?.referrer,
|
|
1146
|
+
});
|
|
1147
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1148
|
+
const event = buildViewLandingpageEvent(context);
|
|
1098
1149
|
const result = this.sendTpaasEvent(event);
|
|
1099
1150
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
this.trackLeaveLandingpage({
|
|
1151
|
+
const leaveLandingpageCallback = async (leave) => {
|
|
1152
|
+
await this.trackLeaveLandingpage({
|
|
1103
1153
|
leave,
|
|
1104
|
-
...input,
|
|
1154
|
+
...context.input,
|
|
1105
1155
|
});
|
|
1106
1156
|
};
|
|
1107
1157
|
addTpaasLeaveTracking({
|
|
1108
|
-
|
|
1109
|
-
pageElement,
|
|
1110
|
-
heightBuilder,
|
|
1111
|
-
objectResizable,
|
|
1158
|
+
...options.leaveTracking,
|
|
1112
1159
|
schema: LeaveLandingpage.object.objectType,
|
|
1113
1160
|
trackMethod: leaveLandingpageCallback,
|
|
1114
1161
|
});
|
|
@@ -1122,23 +1169,23 @@ export default class Tracker {
|
|
|
1122
1169
|
*/
|
|
1123
1170
|
async trackViewListing(input, options) {
|
|
1124
1171
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1125
|
-
this.
|
|
1126
|
-
|
|
1127
|
-
|
|
1172
|
+
this.setCurrentTpaasPageData({
|
|
1173
|
+
id: input.object.objectId,
|
|
1174
|
+
type: ViewListing.object.objectType,
|
|
1175
|
+
referrer: input.page?.referrer,
|
|
1176
|
+
});
|
|
1177
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1178
|
+
const event = buildViewListingEvent(context);
|
|
1128
1179
|
const result = this.sendTpaasEvent(event);
|
|
1129
1180
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
this.trackLeaveListing({
|
|
1181
|
+
const leaveListingCallback = async (leave) => {
|
|
1182
|
+
await this.trackLeaveListing({
|
|
1133
1183
|
leave,
|
|
1134
|
-
...input,
|
|
1184
|
+
...context.input,
|
|
1135
1185
|
});
|
|
1136
1186
|
};
|
|
1137
1187
|
addTpaasLeaveTracking({
|
|
1138
|
-
|
|
1139
|
-
pageElement,
|
|
1140
|
-
heightBuilder,
|
|
1141
|
-
objectResizable,
|
|
1188
|
+
...options.leaveTracking,
|
|
1142
1189
|
schema: LeaveListing.object.objectType,
|
|
1143
1190
|
trackMethod: leaveListingCallback,
|
|
1144
1191
|
});
|
|
@@ -1152,41 +1199,30 @@ export default class Tracker {
|
|
|
1152
1199
|
*/
|
|
1153
1200
|
async trackViewLockedArticle(input, options) {
|
|
1154
1201
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1155
|
-
this.
|
|
1156
|
-
|
|
1157
|
-
|
|
1202
|
+
this.setCurrentTpaasPageData({
|
|
1203
|
+
id: input.object.objectId,
|
|
1204
|
+
type: ViewLockedArticle.object.objectType,
|
|
1205
|
+
referrer: input.page?.referrer,
|
|
1206
|
+
content: input.page?.content,
|
|
1207
|
+
});
|
|
1208
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1209
|
+
const event = buildViewLockedArticleEvent(context);
|
|
1158
1210
|
const result = this.sendTpaasEvent(event);
|
|
1159
1211
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
this.trackLeaveLockedArticle({
|
|
1212
|
+
const leaveLockedArticleCallback = async (leave) => {
|
|
1213
|
+
await this.trackLeaveLockedArticle({
|
|
1163
1214
|
leave,
|
|
1164
|
-
...input,
|
|
1215
|
+
...context.input,
|
|
1165
1216
|
});
|
|
1166
1217
|
};
|
|
1167
1218
|
addTpaasLeaveTracking({
|
|
1168
|
-
|
|
1169
|
-
pageElement,
|
|
1170
|
-
objectResizable,
|
|
1171
|
-
heightBuilder,
|
|
1219
|
+
...options.leaveTracking,
|
|
1172
1220
|
schema: LeaveLockedArticle.object.objectType,
|
|
1173
1221
|
trackMethod: leaveLockedArticleCallback,
|
|
1174
1222
|
});
|
|
1175
1223
|
}
|
|
1176
1224
|
return result;
|
|
1177
1225
|
}
|
|
1178
|
-
/**
|
|
1179
|
-
* @param input
|
|
1180
|
-
* @param options
|
|
1181
|
-
* @category TPaaS Tracking
|
|
1182
|
-
*/
|
|
1183
|
-
async trackViewLockedAudio(input) {
|
|
1184
|
-
// despite the View event type, this is not a page view event, but rather a media object view event
|
|
1185
|
-
// so we shouldn't reset the page view ID here or enable leave tracking
|
|
1186
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
1187
|
-
const event = buildViewLockedAudioEvent(input, dependencies);
|
|
1188
|
-
return this.sendTpaasEvent(event);
|
|
1189
|
-
}
|
|
1190
1226
|
/**
|
|
1191
1227
|
* @param input
|
|
1192
1228
|
* @param options
|
|
@@ -1194,23 +1230,24 @@ export default class Tracker {
|
|
|
1194
1230
|
*/
|
|
1195
1231
|
async trackViewLockedAudioPage(input, options) {
|
|
1196
1232
|
this.newPageView();
|
|
1197
|
-
this.
|
|
1198
|
-
|
|
1199
|
-
|
|
1233
|
+
this.setCurrentTpaasPageData({
|
|
1234
|
+
id: input.object.objectId,
|
|
1235
|
+
type: ViewLockedAudioPage.object.objectType,
|
|
1236
|
+
referrer: input.page?.referrer,
|
|
1237
|
+
content: input.page?.content,
|
|
1238
|
+
});
|
|
1239
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1240
|
+
const event = buildViewLockedAudioPageEvent(context);
|
|
1200
1241
|
const result = this.sendTpaasEvent(event);
|
|
1201
1242
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1204
|
-
this.trackLeaveLockedAudioPage({
|
|
1243
|
+
const leaveLockedAudioPageCallback = async (leave) => {
|
|
1244
|
+
await this.trackLeaveLockedAudioPage({
|
|
1205
1245
|
leave,
|
|
1206
|
-
...input,
|
|
1246
|
+
...context.input,
|
|
1207
1247
|
});
|
|
1208
1248
|
};
|
|
1209
1249
|
addTpaasLeaveTracking({
|
|
1210
|
-
|
|
1211
|
-
pageElement,
|
|
1212
|
-
heightBuilder,
|
|
1213
|
-
objectResizable,
|
|
1250
|
+
...options.leaveTracking,
|
|
1214
1251
|
schema: LeaveLockedAudioPage.object.objectType,
|
|
1215
1252
|
trackMethod: leaveLockedAudioPageCallback,
|
|
1216
1253
|
});
|
|
@@ -1219,14 +1256,33 @@ export default class Tracker {
|
|
|
1219
1256
|
}
|
|
1220
1257
|
/**
|
|
1221
1258
|
* @param input
|
|
1259
|
+
* @param options
|
|
1222
1260
|
* @category TPaaS Tracking
|
|
1223
1261
|
*/
|
|
1224
|
-
async
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1262
|
+
async trackViewLockedPage(input, options) {
|
|
1263
|
+
this.newPageView();
|
|
1264
|
+
this.setCurrentTpaasPageData({
|
|
1265
|
+
id: input.object.objectId,
|
|
1266
|
+
type: ViewLockedPage.object.objectType,
|
|
1267
|
+
referrer: input.page?.referrer,
|
|
1268
|
+
});
|
|
1269
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1270
|
+
const event = buildViewLockedPageEvent(context);
|
|
1271
|
+
const result = this.sendTpaasEvent(event);
|
|
1272
|
+
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1273
|
+
const leaveLockedPageCallback = async (leave) => {
|
|
1274
|
+
await this.trackLeaveLockedPage({
|
|
1275
|
+
leave,
|
|
1276
|
+
...context.input,
|
|
1277
|
+
});
|
|
1278
|
+
};
|
|
1279
|
+
addTpaasLeaveTracking({
|
|
1280
|
+
...options.leaveTracking,
|
|
1281
|
+
schema: LeaveLockedPage.object.objectType,
|
|
1282
|
+
trackMethod: leaveLockedPageCallback,
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
return result;
|
|
1230
1286
|
}
|
|
1231
1287
|
/**
|
|
1232
1288
|
* @param input
|
|
@@ -1235,40 +1291,30 @@ export default class Tracker {
|
|
|
1235
1291
|
*/
|
|
1236
1292
|
async trackViewLockedVideoPage(input, options) {
|
|
1237
1293
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1238
|
-
this.
|
|
1239
|
-
|
|
1240
|
-
|
|
1294
|
+
this.setCurrentTpaasPageData({
|
|
1295
|
+
id: input.object.objectId,
|
|
1296
|
+
type: ViewLockedVideoPage.object.objectType,
|
|
1297
|
+
referrer: input.page?.referrer,
|
|
1298
|
+
content: input.page?.content,
|
|
1299
|
+
});
|
|
1300
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1301
|
+
const event = buildViewLockedVideoPageEvent(context);
|
|
1241
1302
|
const result = this.sendTpaasEvent(event);
|
|
1242
1303
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1245
|
-
this.trackLeaveLockedVideoPage({
|
|
1304
|
+
const leaveLockedVideoPageCallback = async (leave) => {
|
|
1305
|
+
await this.trackLeaveLockedVideoPage({
|
|
1246
1306
|
leave,
|
|
1247
|
-
...input,
|
|
1307
|
+
...context.input,
|
|
1248
1308
|
});
|
|
1249
1309
|
};
|
|
1250
1310
|
addTpaasLeaveTracking({
|
|
1251
|
-
|
|
1252
|
-
pageElement,
|
|
1253
|
-
heightBuilder,
|
|
1254
|
-
objectResizable,
|
|
1311
|
+
...options.leaveTracking,
|
|
1255
1312
|
schema: LeaveLockedVideoPage.object.objectType,
|
|
1256
1313
|
trackMethod: leaveLockedVideoPageCallback,
|
|
1257
1314
|
});
|
|
1258
1315
|
}
|
|
1259
1316
|
return result;
|
|
1260
1317
|
}
|
|
1261
|
-
/**
|
|
1262
|
-
* @param input
|
|
1263
|
-
* @category TPaaS Tracking
|
|
1264
|
-
*/
|
|
1265
|
-
async trackViewVideo(input) {
|
|
1266
|
-
// despite the View event type, this is not a page view event, but rather a media object view event
|
|
1267
|
-
// so we shouldn't reset the page view ID here or enable leave tracking
|
|
1268
|
-
const dependencies = await this.prepareTpaasEvent();
|
|
1269
|
-
const event = buildViewVideoEvent(input, dependencies);
|
|
1270
|
-
return this.sendTpaasEvent(event);
|
|
1271
|
-
}
|
|
1272
1318
|
/**
|
|
1273
1319
|
* Tracks a View VideoPage event and automatically fires a Leave VideoPage event when the user
|
|
1274
1320
|
* navigates away.
|
|
@@ -1313,29 +1359,27 @@ export default class Tracker {
|
|
|
1313
1359
|
*/
|
|
1314
1360
|
async trackViewVideoPage(input, options) {
|
|
1315
1361
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1316
|
-
this.
|
|
1317
|
-
|
|
1318
|
-
|
|
1362
|
+
this.setCurrentTpaasPageData({
|
|
1363
|
+
id: input.object.objectId,
|
|
1364
|
+
type: ViewVideoPage.object.objectType,
|
|
1365
|
+
referrer: input.page?.referrer,
|
|
1366
|
+
content: input.page?.content,
|
|
1367
|
+
});
|
|
1368
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1369
|
+
const event = buildViewVideoPageEvent(context);
|
|
1319
1370
|
const result = this.sendTpaasEvent(event);
|
|
1320
1371
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1321
|
-
const {
|
|
1322
|
-
const leaveVideoCallback = (leave) => {
|
|
1372
|
+
const { leaveStoriesBuilder, ...restLeaveTrackingOptions } = options.leaveTracking;
|
|
1373
|
+
const leaveVideoCallback = async (leave) => {
|
|
1323
1374
|
const leaveStoriesInput = leaveStoriesBuilder?.();
|
|
1324
|
-
this.trackLeaveVideoPage({
|
|
1375
|
+
await this.trackLeaveVideoPage({
|
|
1325
1376
|
leave,
|
|
1326
|
-
leaveStories: leaveStoriesInput
|
|
1327
|
-
|
|
1328
|
-
activityDurationMs: leave.activityDurationMs,
|
|
1329
|
-
durationMs: leave.durationMs,
|
|
1330
|
-
},
|
|
1331
|
-
...input,
|
|
1377
|
+
leaveStories: leaveStoriesInput,
|
|
1378
|
+
...context.input,
|
|
1332
1379
|
});
|
|
1333
1380
|
};
|
|
1334
1381
|
addTpaasLeaveTracking({
|
|
1335
|
-
|
|
1336
|
-
pageElement,
|
|
1337
|
-
heightBuilder,
|
|
1338
|
-
objectResizable,
|
|
1382
|
+
...restLeaveTrackingOptions,
|
|
1339
1383
|
schema: LeaveVideoPage.object.objectType,
|
|
1340
1384
|
trackMethod: leaveVideoCallback,
|
|
1341
1385
|
});
|
|
@@ -1349,23 +1393,23 @@ export default class Tracker {
|
|
|
1349
1393
|
*/
|
|
1350
1394
|
async trackViewWeather(input, options) {
|
|
1351
1395
|
this.newPageView(); // Reset the page view ID if it is not set, to ensure a new page view is tracked
|
|
1352
|
-
this.
|
|
1353
|
-
|
|
1354
|
-
|
|
1396
|
+
this.setCurrentTpaasPageData({
|
|
1397
|
+
id: input.object.objectId,
|
|
1398
|
+
type: ViewWeather.object.objectType,
|
|
1399
|
+
referrer: input.page?.referrer,
|
|
1400
|
+
});
|
|
1401
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1402
|
+
const event = buildViewWeatherEvent(context);
|
|
1355
1403
|
const result = this.sendTpaasEvent(event);
|
|
1356
1404
|
if (shouldEnableLeaveTracking(options.leaveTracking)) {
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
this.trackLeaveWeather({
|
|
1405
|
+
const leaveWeatherCallback = async (leave) => {
|
|
1406
|
+
await this.trackLeaveWeather({
|
|
1360
1407
|
leave,
|
|
1361
|
-
...input,
|
|
1408
|
+
...context.input,
|
|
1362
1409
|
});
|
|
1363
1410
|
};
|
|
1364
1411
|
addTpaasLeaveTracking({
|
|
1365
|
-
|
|
1366
|
-
pageElement,
|
|
1367
|
-
heightBuilder,
|
|
1368
|
-
objectResizable,
|
|
1412
|
+
...options.leaveTracking,
|
|
1369
1413
|
schema: LeaveWeather.object.objectType,
|
|
1370
1414
|
trackMethod: leaveWeatherCallback,
|
|
1371
1415
|
});
|
|
@@ -1377,8 +1421,8 @@ export default class Tracker {
|
|
|
1377
1421
|
* @category TPaaS Tracking
|
|
1378
1422
|
*/
|
|
1379
1423
|
async trackLeaveArticle(input) {
|
|
1380
|
-
const
|
|
1381
|
-
const event = buildLeaveArticleEvent(
|
|
1424
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1425
|
+
const event = buildLeaveArticleEvent(context);
|
|
1382
1426
|
return this.sendTpaasEvent(event);
|
|
1383
1427
|
}
|
|
1384
1428
|
/**
|
|
@@ -1386,8 +1430,8 @@ export default class Tracker {
|
|
|
1386
1430
|
* @category TPaaS Tracking
|
|
1387
1431
|
*/
|
|
1388
1432
|
async trackLeaveAudioPage(input) {
|
|
1389
|
-
const
|
|
1390
|
-
const event = buildLeaveAudioPageEvent(
|
|
1433
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1434
|
+
const event = buildLeaveAudioPageEvent(context);
|
|
1391
1435
|
return this.sendTpaasEvent(event);
|
|
1392
1436
|
}
|
|
1393
1437
|
/**
|
|
@@ -1395,8 +1439,8 @@ export default class Tracker {
|
|
|
1395
1439
|
* @category TPaaS Tracking
|
|
1396
1440
|
*/
|
|
1397
1441
|
async trackLeaveError(input) {
|
|
1398
|
-
const
|
|
1399
|
-
const event = buildLeaveErrorEvent(
|
|
1442
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1443
|
+
const event = buildLeaveErrorEvent(context);
|
|
1400
1444
|
return this.sendTpaasEvent(event);
|
|
1401
1445
|
}
|
|
1402
1446
|
/**
|
|
@@ -1404,8 +1448,8 @@ export default class Tracker {
|
|
|
1404
1448
|
* @category TPaaS Tracking
|
|
1405
1449
|
*/
|
|
1406
1450
|
async trackLeaveFrontpage(input) {
|
|
1407
|
-
const
|
|
1408
|
-
const event = buildLeaveFrontpageEvent(
|
|
1451
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1452
|
+
const event = buildLeaveFrontpageEvent(context);
|
|
1409
1453
|
return this.sendTpaasEvent(event);
|
|
1410
1454
|
}
|
|
1411
1455
|
/**
|
|
@@ -1413,8 +1457,8 @@ export default class Tracker {
|
|
|
1413
1457
|
* @category TPaaS Tracking
|
|
1414
1458
|
*/
|
|
1415
1459
|
async trackLeaveLandingpage(input) {
|
|
1416
|
-
const
|
|
1417
|
-
const event = buildLeaveLandingpageEvent(
|
|
1460
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1461
|
+
const event = buildLeaveLandingpageEvent(context);
|
|
1418
1462
|
return this.sendTpaasEvent(event);
|
|
1419
1463
|
}
|
|
1420
1464
|
/**
|
|
@@ -1422,8 +1466,8 @@ export default class Tracker {
|
|
|
1422
1466
|
* @category TPaaS Tracking
|
|
1423
1467
|
*/
|
|
1424
1468
|
async trackLeaveListing(input) {
|
|
1425
|
-
const
|
|
1426
|
-
const event = buildLeaveListingEvent(
|
|
1469
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1470
|
+
const event = buildLeaveListingEvent(context);
|
|
1427
1471
|
return this.sendTpaasEvent(event);
|
|
1428
1472
|
}
|
|
1429
1473
|
/**
|
|
@@ -1431,62 +1475,62 @@ export default class Tracker {
|
|
|
1431
1475
|
* @category TPaaS Tracking
|
|
1432
1476
|
*/
|
|
1433
1477
|
async trackLeaveLockedArticle(input) {
|
|
1434
|
-
const
|
|
1435
|
-
const event = buildLeaveLockedArticleEvent(
|
|
1478
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1479
|
+
const event = buildLeaveLockedArticleEvent(context);
|
|
1436
1480
|
return this.sendTpaasEvent(event);
|
|
1437
1481
|
}
|
|
1438
1482
|
/**
|
|
1439
1483
|
* @param input
|
|
1440
1484
|
* @category TPaaS Tracking
|
|
1441
1485
|
*/
|
|
1442
|
-
async
|
|
1443
|
-
const
|
|
1444
|
-
const event =
|
|
1486
|
+
async trackLeaveLockedAudioPage(input) {
|
|
1487
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1488
|
+
const event = buildLeaveLockedAudioPageEvent(context);
|
|
1445
1489
|
return this.sendTpaasEvent(event);
|
|
1446
1490
|
}
|
|
1447
1491
|
/**
|
|
1448
1492
|
* @param input
|
|
1449
1493
|
* @category TPaaS Tracking
|
|
1450
1494
|
*/
|
|
1451
|
-
async
|
|
1452
|
-
const
|
|
1453
|
-
const event =
|
|
1495
|
+
async trackLeaveLockedPage(input) {
|
|
1496
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1497
|
+
const event = buildLeaveLockedPageEvent(context);
|
|
1454
1498
|
return this.sendTpaasEvent(event);
|
|
1455
1499
|
}
|
|
1456
1500
|
/**
|
|
1457
1501
|
* @param input
|
|
1458
1502
|
* @category TPaaS Tracking
|
|
1459
1503
|
*/
|
|
1460
|
-
async
|
|
1461
|
-
const
|
|
1462
|
-
const event =
|
|
1504
|
+
async trackLeaveLockedVideoPage(input) {
|
|
1505
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1506
|
+
const event = buildLeaveLockedVideoPageEvent(context);
|
|
1463
1507
|
return this.sendTpaasEvent(event);
|
|
1464
1508
|
}
|
|
1465
1509
|
/**
|
|
1466
1510
|
* @param input
|
|
1467
1511
|
* @category TPaaS Tracking
|
|
1468
1512
|
*/
|
|
1469
|
-
async
|
|
1470
|
-
const
|
|
1471
|
-
const event =
|
|
1513
|
+
async trackLeavePage(input) {
|
|
1514
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1515
|
+
const event = buildLeavePageEvent(context);
|
|
1472
1516
|
return this.sendTpaasEvent(event);
|
|
1473
1517
|
}
|
|
1474
1518
|
/**
|
|
1475
1519
|
* @param input
|
|
1476
1520
|
* @category TPaaS Tracking
|
|
1477
1521
|
*/
|
|
1478
|
-
async
|
|
1479
|
-
const
|
|
1480
|
-
const event =
|
|
1522
|
+
async trackLeaveSportsPage(input) {
|
|
1523
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1524
|
+
const event = buildLeaveSportsPageEvent(context);
|
|
1481
1525
|
return this.sendTpaasEvent(event);
|
|
1482
1526
|
}
|
|
1483
1527
|
/**
|
|
1484
1528
|
* @param input
|
|
1485
1529
|
* @category TPaaS Tracking
|
|
1486
1530
|
*/
|
|
1487
|
-
async
|
|
1488
|
-
const
|
|
1489
|
-
const event =
|
|
1531
|
+
async trackLeaveSchoolPage(input) {
|
|
1532
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1533
|
+
const event = buildLeaveSchoolPageEvent(context);
|
|
1490
1534
|
return this.sendTpaasEvent(event);
|
|
1491
1535
|
}
|
|
1492
1536
|
/**
|
|
@@ -1494,8 +1538,8 @@ export default class Tracker {
|
|
|
1494
1538
|
* @category TPaaS Tracking
|
|
1495
1539
|
*/
|
|
1496
1540
|
async trackLeaveVideoPage(input) {
|
|
1497
|
-
const
|
|
1498
|
-
const event = buildLeaveVideoPageEvent(
|
|
1541
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1542
|
+
const event = buildLeaveVideoPageEvent(context);
|
|
1499
1543
|
return this.sendTpaasEvent(event);
|
|
1500
1544
|
}
|
|
1501
1545
|
/**
|
|
@@ -1503,8 +1547,26 @@ export default class Tracker {
|
|
|
1503
1547
|
* @category TPaaS Tracking
|
|
1504
1548
|
*/
|
|
1505
1549
|
async trackLeaveWeather(input) {
|
|
1506
|
-
const
|
|
1507
|
-
const event = buildLeaveWeatherEvent(
|
|
1550
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1551
|
+
const event = buildLeaveWeatherEvent(context);
|
|
1552
|
+
return this.sendTpaasEvent(event);
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* @param input
|
|
1556
|
+
* @category TPaaS Tracking
|
|
1557
|
+
*/
|
|
1558
|
+
async trackEngagementAd(input) {
|
|
1559
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1560
|
+
const event = buildEngagementAdEvent(context);
|
|
1561
|
+
return this.sendTpaasEvent(event);
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* @param input
|
|
1565
|
+
* @category TPaaS Tracking
|
|
1566
|
+
*/
|
|
1567
|
+
async trackEngagementAffiliate(input) {
|
|
1568
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1569
|
+
const event = buildEngagementAffiliateEvent(context);
|
|
1508
1570
|
return this.sendTpaasEvent(event);
|
|
1509
1571
|
}
|
|
1510
1572
|
/**
|
|
@@ -1512,8 +1574,8 @@ export default class Tracker {
|
|
|
1512
1574
|
* @category TPaaS Tracking
|
|
1513
1575
|
*/
|
|
1514
1576
|
async trackEngagementAudio(input) {
|
|
1515
|
-
const
|
|
1516
|
-
const event = buildEngagementAudioEvent(
|
|
1577
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1578
|
+
const event = buildEngagementAudioEvent(context);
|
|
1517
1579
|
return this.sendTpaasEvent(event);
|
|
1518
1580
|
}
|
|
1519
1581
|
/**
|
|
@@ -1521,8 +1583,8 @@ export default class Tracker {
|
|
|
1521
1583
|
* @category TPaaS Tracking
|
|
1522
1584
|
*/
|
|
1523
1585
|
async trackEngagementForm(input) {
|
|
1524
|
-
const
|
|
1525
|
-
const event = buildEngagementFormEvent(
|
|
1586
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1587
|
+
const event = buildEngagementFormEvent(context);
|
|
1526
1588
|
return this.sendTpaasEvent(event);
|
|
1527
1589
|
}
|
|
1528
1590
|
/**
|
|
@@ -1530,8 +1592,26 @@ export default class Tracker {
|
|
|
1530
1592
|
* @category TPaaS Tracking
|
|
1531
1593
|
*/
|
|
1532
1594
|
async trackEngagementOffer(input) {
|
|
1533
|
-
const
|
|
1534
|
-
const event = buildEngagementOfferEvent(
|
|
1595
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1596
|
+
const event = buildEngagementOfferEvent(context);
|
|
1597
|
+
return this.sendTpaasEvent(event);
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* @param input
|
|
1601
|
+
* @category TPaaS Tracking
|
|
1602
|
+
*/
|
|
1603
|
+
async trackEngagementSportsUIElement(input) {
|
|
1604
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1605
|
+
const event = buildEngagementSportsUIElementEvent(context);
|
|
1606
|
+
return this.sendTpaasEvent(event);
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* @param input
|
|
1610
|
+
* @category TPaaS Tracking
|
|
1611
|
+
*/
|
|
1612
|
+
async trackEngagementSchoolUIElement(input) {
|
|
1613
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1614
|
+
const event = buildEngagementSchoolUIElementEvent(context);
|
|
1535
1615
|
return this.sendTpaasEvent(event);
|
|
1536
1616
|
}
|
|
1537
1617
|
/**
|
|
@@ -1539,8 +1619,26 @@ export default class Tracker {
|
|
|
1539
1619
|
* @category TPaaS Tracking
|
|
1540
1620
|
*/
|
|
1541
1621
|
async trackEngagementTeaser(input) {
|
|
1542
|
-
const
|
|
1543
|
-
const event = buildEngagementTeaserEvent(
|
|
1622
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1623
|
+
const event = buildEngagementTeaserEvent(context);
|
|
1624
|
+
return this.sendTpaasEvent(event);
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* @param input
|
|
1628
|
+
* @category TPaaS Tracking
|
|
1629
|
+
*/
|
|
1630
|
+
async trackEngagementTvModule(input) {
|
|
1631
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1632
|
+
const event = buildEngagementTvModuleEvent(context);
|
|
1633
|
+
return this.sendTpaasEvent(event);
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* @param input
|
|
1637
|
+
* @category TPaaS Tracking
|
|
1638
|
+
*/
|
|
1639
|
+
async trackEngagementTvSearch(input) {
|
|
1640
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1641
|
+
const event = buildEngagementTvSearchEvent(context);
|
|
1544
1642
|
return this.sendTpaasEvent(event);
|
|
1545
1643
|
}
|
|
1546
1644
|
/**
|
|
@@ -1548,8 +1646,8 @@ export default class Tracker {
|
|
|
1548
1646
|
* @category TPaaS Tracking
|
|
1549
1647
|
*/
|
|
1550
1648
|
async trackEngagementUIElement(input) {
|
|
1551
|
-
const
|
|
1552
|
-
const event = buildEngagementUIElementEvent(
|
|
1649
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1650
|
+
const event = buildEngagementUIElementEvent(context);
|
|
1553
1651
|
return this.sendTpaasEvent(event);
|
|
1554
1652
|
}
|
|
1555
1653
|
/**
|
|
@@ -1557,8 +1655,8 @@ export default class Tracker {
|
|
|
1557
1655
|
* @category TPaaS Tracking
|
|
1558
1656
|
*/
|
|
1559
1657
|
async trackEngagementVideo(input) {
|
|
1560
|
-
const
|
|
1561
|
-
const event = buildEngagementVideoEvent(
|
|
1658
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1659
|
+
const event = buildEngagementVideoEvent(context);
|
|
1562
1660
|
return this.sendTpaasEvent(event);
|
|
1563
1661
|
}
|
|
1564
1662
|
/**
|
|
@@ -1566,8 +1664,8 @@ export default class Tracker {
|
|
|
1566
1664
|
* @category TPaaS Tracking
|
|
1567
1665
|
*/
|
|
1568
1666
|
async trackEngagementVideoAd(input) {
|
|
1569
|
-
const
|
|
1570
|
-
const event = buildEngagementVideoAdEvent(
|
|
1667
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1668
|
+
const event = buildEngagementVideoAdEvent(context);
|
|
1571
1669
|
return this.sendTpaasEvent(event);
|
|
1572
1670
|
}
|
|
1573
1671
|
/**
|
|
@@ -1575,8 +1673,17 @@ export default class Tracker {
|
|
|
1575
1673
|
* @category TPaaS Tracking
|
|
1576
1674
|
*/
|
|
1577
1675
|
async trackEngagementWidget(input) {
|
|
1578
|
-
const
|
|
1579
|
-
const event = buildEngagementWidgetEvent(
|
|
1676
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1677
|
+
const event = buildEngagementWidgetEvent(context);
|
|
1678
|
+
return this.sendTpaasEvent(event);
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* @param input
|
|
1682
|
+
* @category TPaaS Tracking
|
|
1683
|
+
*/
|
|
1684
|
+
async trackHeartbeatCommercialArticle(input) {
|
|
1685
|
+
const context = await prepareTpaasEventContext(this.tpaasContextSource, input);
|
|
1686
|
+
const event = buildHeartbeatCommercialArticleEvent(context);
|
|
1580
1687
|
return this.sendTpaasEvent(event);
|
|
1581
1688
|
}
|
|
1582
1689
|
/**
|
|
@@ -1585,9 +1692,6 @@ export default class Tracker {
|
|
|
1585
1692
|
* @category TPaaS Tracking
|
|
1586
1693
|
*/
|
|
1587
1694
|
async sendTpaasEvent(event) {
|
|
1588
|
-
// Resolve any pending session ID promises
|
|
1589
|
-
// (session was created when the event was built)
|
|
1590
|
-
this.resolveSessionIdPromise();
|
|
1591
1695
|
// The Hybrid use case implements a "bridged" event method, injected into the window scope,
|
|
1592
1696
|
// which is used to send events through the native app.
|
|
1593
1697
|
if (isFunction(this.state.altEventHandler)) {
|
|
@@ -1851,7 +1955,7 @@ export default class Tracker {
|
|
|
1851
1955
|
* If no session exists yet, returns a promise that resolves with the session ID
|
|
1852
1956
|
* when it gets created (typically when the first non-anonymous tracking event is sent).
|
|
1853
1957
|
*
|
|
1854
|
-
* Note: Anonymous events (such as those sent via {@link trackAnonymous} or {@link
|
|
1958
|
+
* Note: Anonymous events (such as those sent via {@link trackAnonymous} or {@link trackAnonymousImpressionUIElement})
|
|
1855
1959
|
* do not create sessions and will not resolve pending session ID promises. The promise will only resolve when a
|
|
1856
1960
|
* non-anonymous tracking event is sent.
|
|
1857
1961
|
*
|
|
@@ -1862,8 +1966,8 @@ export default class Tracker {
|
|
|
1862
1966
|
*/
|
|
1863
1967
|
getSessionId() {
|
|
1864
1968
|
const session = readSession();
|
|
1865
|
-
if (session
|
|
1866
|
-
return Promise.resolve(session.
|
|
1969
|
+
if (session) {
|
|
1970
|
+
return Promise.resolve(generateSessionSDRN(session.sessionId));
|
|
1867
1971
|
}
|
|
1868
1972
|
// No session exists yet, create or return existing promise
|
|
1869
1973
|
if (!this.sessionIdPromise) {
|
|
@@ -2222,8 +2326,8 @@ export default class Tracker {
|
|
|
2222
2326
|
* with the added guarantee that a second Leave event will not be triggered if one already has been sent.
|
|
2223
2327
|
* @category TPaaS Leave Tracking
|
|
2224
2328
|
*/
|
|
2225
|
-
trackTpaasActiveLeave() {
|
|
2226
|
-
trackTpaasActiveLeave();
|
|
2329
|
+
async trackTpaasActiveLeave() {
|
|
2330
|
+
await trackTpaasActiveLeave();
|
|
2227
2331
|
}
|
|
2228
2332
|
/**
|
|
2229
2333
|
* Check if leave tracking is enabled (if an event will be sent when the user leaves the page)
|
|
@@ -2252,8 +2356,9 @@ export default class Tracker {
|
|
|
2252
2356
|
/**
|
|
2253
2357
|
* @private
|
|
2254
2358
|
*/
|
|
2255
|
-
async
|
|
2256
|
-
|
|
2359
|
+
async resolveAnonymousTrackGlobals() {
|
|
2360
|
+
// Omit before evaluation so forbidden promise/function builders cannot delay or fail anonymous tracking.
|
|
2361
|
+
return evaluateAndFlatten(omit(this.builders, ANONYMOUS_EVENT_FORBIDDEN_FIELDS));
|
|
2257
2362
|
}
|
|
2258
2363
|
/**
|
|
2259
2364
|
* Send all anonymous events that are in the internal anonymous event queue.
|
|
@@ -2317,12 +2422,18 @@ export default class Tracker {
|
|
|
2317
2422
|
async prepareQueuesAndSend(eventQueue, retryEventQueue) {
|
|
2318
2423
|
const promisesToBeSent = eventQueue.splice(0);
|
|
2319
2424
|
const eventsToBeSent = promisesToBeSent.map((p) => p.inputValue);
|
|
2320
|
-
const eventsToRetry = retryEventQueue;
|
|
2425
|
+
const eventsToRetry = retryEventQueue.splice(0);
|
|
2321
2426
|
eventQueue.length = 0;
|
|
2322
2427
|
retryEventQueue.length = 0;
|
|
2323
2428
|
const evaluatedEvents = await Promise.all(eventsToBeSent);
|
|
2324
2429
|
const url = this._getCollectorPath();
|
|
2325
2430
|
const data = [...evaluatedEvents, ...eventsToRetry];
|
|
2431
|
+
// in some cases, _sendImmediately executes an asynchronous operation (cisSync) after checking for empty array
|
|
2432
|
+
// due to that, it's still possible for this function to be called with an empty array, so we need to check for that again before sending
|
|
2433
|
+
// in order to avoid making an empty request to collector
|
|
2434
|
+
if (data.length === 0) {
|
|
2435
|
+
return [];
|
|
2436
|
+
}
|
|
2326
2437
|
// biome-ignore lint/suspicious/noExplicitAny: -
|
|
2327
2438
|
async function onFailedSend(response) {
|
|
2328
2439
|
// We retry an event once, but discard already retried events
|
|
@@ -2371,9 +2482,9 @@ export default class Tracker {
|
|
|
2371
2482
|
*/
|
|
2372
2483
|
resolveSessionIdPromise() {
|
|
2373
2484
|
const session = readSession();
|
|
2374
|
-
if (session
|
|
2485
|
+
if (session) {
|
|
2375
2486
|
eventBus.emit('tracker:session:new', {
|
|
2376
|
-
sessionId: session.
|
|
2487
|
+
sessionId: generateSessionSDRN(session.sessionId),
|
|
2377
2488
|
});
|
|
2378
2489
|
}
|
|
2379
2490
|
}
|