Adobe Analytics for Popup

Hi,
Is there a way to modify the tracking script for it to work with Adobe Analytics insted of Google Analytics? Thank you!

2 Likes

Hi there, @user4477 and welcome aboard :waving_hand:

Interesting question!

I guess it’s possible. Could you please send me a link to the page where your Popup widget is installed or just specify its ID? We’ll gladly look into this for you :slightly_smiling_face:

1 Like

Hi Max, thank you for your reply!

The widget ID is 32f9a650-0b14-4dec-be02-c8b21a1a17bb and we’ve installed it here: Ausflugsziele - Wetter-Alarm

2 Likes

Thanks! You’d like to track clicks on all widget elements (popup itself, button, close button), right?

1 Like

Yes, altough it would be important to be able to differentiate between the elements. So that we know if the user closes the popup or clicks out CTA :slight_smile:

2 Likes

Got it, thanks!

Your request is with our devs now. I’ll update you once I have their response :slightly_smiling_face:

1 Like

Hi there, @user4477 :waving_hand:

We’ve added this script to the Custom JS field on the Settings tab of your widget’s settings that should pull the click stats to your Adobe account:

function addAdobeAnalytics() {
  waitForElement('[class*="PopupCloseControl__PopupCloseControlContainer-sc"]').then(closeBtn => {
    if (!closeBtn.dataset.analyticsAttached) {
      closeBtn.addEventListener('click', () => {
        s.tl(this, 'o', 'Popup Close Button Click');
      });
      closeBtn.dataset.analyticsAttached = 'true';
    }

    const banner = document.querySelector('[class*="Banner__Container-sc"]');
    if (banner && !banner.dataset.analyticsAttached) {
      banner.addEventListener('click', () => {
        s.tl(this, 'o', 'Popup Click');
      });
      banner.dataset.analyticsAttached = 'true';
    }

    const baseButton = document.querySelector('[class*="ButtonBase__ButtonContainer-sc"]');
    if (baseButton && !baseButton.dataset.analyticsAttached) {
      baseButton.addEventListener('click', () => {
        s.tl(this, 'o', 'Popup Button Click');
      });
      baseButton.dataset.analyticsAttached = 'true';
    }

    addAdobeAnalytics();
  });
}

addAdobeAnalytics();

Please check it out and let me know how it goes :slightly_smiling_face: