Expand my Community achievements bar.

Join us at Adobe Summit 2024 for the Coffee Break Q&A Live series, a unique opportunity to network with and learn from expert users, the Adobe product team, and Adobe partners in a small group, 30 minute AMA conversations.
SOLVED

Iframe load event - Adobe Data Collection

Avatar

Level 6

Hi ,

 

We have a iframe form on landing page and ask is to measure the no of times the iframe is successfully loaded. Is there any solution for this in Adoe analytics ?

 

Triggering an data layer on i frame load event is good option ? Please sugget.

 

Thanks,

Pradeep

1 Accepted Solution

Avatar

Correct answer by
Level 2

Assuming your Adobe Data Collection Tags (Launch) code is loading in the parent window, so long as the iframe content has the same-origin (hostname) you can use something like this in a Rule Event -> Extension:Core -> Event Type:Custom Code

document.getElementById('your iframe id here').onload = function() {
  trigger();
};

 

-Phil

View solution in original post

3 Replies

Avatar

Correct answer by
Level 2

Assuming your Adobe Data Collection Tags (Launch) code is loading in the parent window, so long as the iframe content has the same-origin (hostname) you can use something like this in a Rule Event -> Extension:Core -> Event Type:Custom Code

document.getElementById('your iframe id here').onload = function() {
  trigger();
};

 

-Phil

Avatar

Community Advisor

There is another thing that you would want to make sure of when tracking the iframe.... if the data is going into the main suite (same as the parent site), then you don't want to track the iframe as a page view s.t() on the initial loading of the page.... as this will cause double tracking of page views every time the parent page is loaded.

You would want to add some constraints to prevent the initial load from triggering a Page View (basically, when the parent page is loaded the initial iframe load should be part of the parent's PV event.. not its own separate call)... this makes the implementation trickier.. but it's better than inflating your stats.

Avatar

Community Advisor

It's kind of unusual to want to track when an IFRAME gets loaded. ... unless you're trying to do some UI troubleshooting, in which case, ok, that makes sense (or maybe the devs could check their logs too to see if the IFRAME's content actually gets loaded).

The method suggested by @philschmidt should work for you. Or if your devs are loading the IFRAME via a script, then ask them to add a _satellite.track Direct Call or push to your parent window's data layer at the end of their code. Whatever it is, do keep in mind @Jennifer_Dungan's warning, so that you're not double-counting your IFRAME content.