Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
add custom values to floodlight pixel for conversion label and conver…
Browse files Browse the repository at this point in the history
…sion id

 🐿 v2.12.3
  • Loading branch information
jkerr321 committed May 1, 2019
1 parent d9c00af commit 817135a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions components/n-ui/tracking/third-party/floodlight.js
Expand Up @@ -29,12 +29,14 @@ module.exports = function (flags) {
document.body.dispatchEvent(event);
};

const gtagEvent = (sendTo) => {
const gtagEvent = ({sendTo, conversionLabel}) => {
window.gtag('event', 'conversion', {
'allow_custom_scripts': true,
'send_to': sendTo,
'u1': '[u10]',
'u10': spoorId,
'send_to': sendTo
'u3': conversionLabel || undefined,
'u4': '801156123'
});
// Fix a11y issue with this iframe not having a title element.
const iframes = document.querySelectorAll('iframe[src*="doubleclick.net"]');
Expand All @@ -45,23 +47,23 @@ module.exports = function (flags) {

if (flags && (flags.get('floodlight') && spoorId)) {
if (isSignUpForm) {
gtagEvent('DC-9073629/ftsig0/ftmem0+standard');
gtagEvent({ sendTo: 'DC-9073629/ftsig0/ftmem0+standard', conversionLabel: 'LbQoCMCdwpgBEJvYgv4C' });
} else if (isTrialConfirmation) {
gtagEvent('DC-9073629/ftcon00/fttri0+standard');
gtagEvent({ sendTo: 'DC-9073629/ftcon00/fttri0+standard', conversionLabel: 'PgrhCNn-uJgBEJvYgv4C' });
} else if (isSubscriptionConfirmation) {
gtagEvent('DC-9073629/ftcon0/ftsub0+standard');
gtagEvent({ sendTo: 'DC-9073629/ftcon0/ftsub0+standard', conversionLabel: 'ACJ0COO0rpgBEJvYgv4C' });
} else if (isBarrier) {
gtagEvent('DC-9073629/ftbar0/ftlan0+standard');
gtagEvent({ sendTo: 'DC-9073629/ftbar0/ftlan0+standard', conversionLabel: 'I9pgCMe2rpgBEJvYgv4C' });
// Note: move this call into the `gtagEvent` call when removing the old code.
customTrackingEvent();
} else if (isSubscriber) {
gtagEvent('DC-9073629/ftsub0/ftlog0+standard');
gtagEvent({ sendTo: 'DC-9073629/ftsub0/ftlog0+standard', conversionLabel: 'kgKFCIn5uJgBEJvYgv4C' });
customTrackingEvent();
} else if (isRegistered) {
gtagEvent('DC-9073629/ftreg0/ftlog0+standard');
gtagEvent({ sendTo: 'DC-9073629/ftreg0/ftlog0+standard', conversionLabel: 'sCLX1uJgBEJvYgv4C' });
customTrackingEvent();
} else if (isAnonymous) {
gtagEvent('DC-9073629/ftrem0/ftsit0+standard');
gtagEvent({sendTo: 'DC-9073629/ftrem0/ftsit0+standard'});
}
}
};

0 comments on commit 817135a

Please sign in to comment.