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

Add p1event tracking for content meter component #1019

Merged
merged 8 commits into from
Dec 2, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 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('View');
dataLayer.push(payload);
const { searchParams } = new URL(window.location.href);
if (searchParams.has('idxDebugger')) {
Expand All @@ -69,8 +70,24 @@ export default {
this.EventBus.$on('identity-x-login-link-sent', ({ actionSource }) => {
if (actionSource === 'content_meter_login') {
this.classes.push('login-link-sent');
this.emitP1Event('Submit');
}
});
},
methods: {
emitP1Event(action) {
B77Mills marked this conversation as resolved.
Show resolved Hide resolved
if (!window.p1events) return;
const { views, remaining, overlayDisplayed } = this;
const label = !overlayDisplayed ? null : 'Gated';
console.log('label: ', label)
B77Mills marked this conversation as resolved.
Show resolved Hide resolved
window.p1events('track', {
category: 'Content Meter',
action,
...(label && { label }),
B77Mills marked this conversation as resolved.
Show resolved Hide resolved
props: { n: views },
});
this.EventBus.$emit(`identity-x-content-meter-${action}`, { payload: { views, remaining, overlayDisplayed }});
},
},
};
</script>
Loading