Expand my Community achievements bar.

Announcement: Calling all learners and mentors! Applications are now open for the Adobe Analytics 2024 Mentorship Program! Come learn from the best to prepare for an official certification in Adobe Analytics.
SOLVED

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

Avatar

Level 6

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.

 

aagk123_0-1694521642171.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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....

View solution in original post

3 Replies

Avatar

Community Advisor

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 = "";

Avatar

Level 6

Thanks so much but any solution without developer ?

Avatar

Correct answer by
Community Advisor

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....