Any way to track browser pop up as event using adobe launch? | Community
Skip to main content
Level 5
September 12, 2023
Solved

Any way to track browser pop up as event using adobe launch?

  • September 12, 2023
  • 1 reply
  • 1255 views

Any way to track browser pop-ups as events using Adobe Launch? We have multiple popup in same page like shown below. I need to differentiate using text displayed in form. This is not allowing me to inspect element.

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

Not sure... you might be able to detect something without a custom event... (basically you can try to detect based on standard web events)... then trying to identify what that popup is would be the next challenge....

1 reply

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 12, 2023

For this, you may need your developers to create a custom JS event (where they can also provide details in the event.details parameters) that you can listen for an create tracking around.

 

https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events

 

Example:

document.dispatchEvent(new CustomEvent("popup", { detail: { name: "payment term" } }));

 

 

In Launch, you can create a custom code trigger for the "popup" event:

document.addEventListener("popup", function(event) { window.popupDetails = event.detail; trigger(); });

 

The "trigger();" part is what allows the custom trigger to move onto the actions of your Rule, you will also noticed that I created a window level object to hold the event detail content (so that it can be read within the actions) - while you should be able to read from event.detail directly, depending on timing of your actions, the info could self-destruct before you get to it (hence adding it to a temp window object ensures that this is fully available to you).

 

 

Now, in your actions, you can pull from window.popupDetails to get all the passed values (in JSON format), or you can pull specific fields with window.popupDetails.name and build out your tracking (you can still use Data Elements pulling from window.popupDetails.name, and use as you would any other Data Element.

 

If you may have multiple popups on the same page, or your site is an SPA, it would be safe to add one rule to your action to clear window.popupDetails once you have extracted everything from it in your tracking:

 

// Clear the temp object window.popupDetails = "";
aagk123Author
Level 5
September 12, 2023

Thanks so much but any solution without developer ?

Jennifer_Dungan
Community Advisor and Adobe Champion
Jennifer_DunganCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
September 12, 2023

Not sure... you might be able to detect something without a custom event... (basically you can try to detect based on standard web events)... then trying to identify what that popup is would be the next challenge....