Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1019 from B77Mills/meterTracking
Browse files Browse the repository at this point in the history
Add p1event tracking for content meter component
  • Loading branch information
B77Mills authored Dec 2, 2024
2 parents 4fd412c + ec1d74d commit 6ab7402
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/marko-web-theme-monorail/browser/content-meter-track.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default {
overlayDisplayed,
},
};
this.emitP1Event({ action: 'View' });
dataLayer.push(payload);
const { searchParams } = new URL(window.location.href);
if (searchParams.has('idxDebugger')) {
Expand All @@ -69,8 +70,21 @@ export default {
this.EventBus.$on('identity-x-login-link-sent', ({ actionSource }) => {
if (actionSource === 'content_meter_login') {
this.classes.push('login-link-sent');
this.emitP1Event({ action: 'Submit' });
}
});
},
methods: {
emitP1Event({ action }) {
if (!window.p1events) return;
const { views, overlayDisplayed } = this;
window.p1events('track', {
category: 'Content Meter',
action,
...(overlayDisplayed && { label: 'Gated' }),
props: { n: views },
});
},
},
};
</script>

0 comments on commit 6ab7402

Please sign in to comment.