Iframe load event - Adobe Data Collection | Community
Skip to main content
pradeep_07
Level 4
May 17, 2023
Solved

Iframe load event - Adobe Data Collection

  • May 17, 2023
  • 2 replies
  • 2077 views

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

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 philschmidt

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

2 replies

philschmidt
philschmidtAccepted solution
Level 2
May 17, 2023

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

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 18, 2023

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.

yuhuisg
Community Advisor
Community Advisor
May 18, 2023

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.