Let's assume we're using 2 different Tealium profiles: the "parent" profile will be loaded on the main website (or parent), and the iframe (or child) will be using "child" profile. We will need to make changes in both profiles to make the tracking work.
We have already determined that we will use the child profile to send events to the parent profile. So the parent profile will have 2 tasks:
- Receiving events from the child profile (iframe).
- Letting the child profile know that it is ready to receive events.
This first task is obvious, but let's see why this second task is necessary. When a website is loading an iframe, it is possible that the iframe will finish loading before the website itself. This means that the child profile would load before the parent profile. Of course, this is not always the case, it is also possible for the parent profile to load before the child profile. This is important to consider because the child profile should not send events to the parent profile before it is ready to receive them.
The child profile will also have some tasks it needs to accomplish:
- Measuring events.
- Waiting for the parent profile to be ready to receive events.
- Sending events to the parent profile.
Of course, we need to measure events. This could be as simple as measuring pageviews, but can be extended to any event like form tracking, button clicks, etc.. When an event occurs, we have to be sure that the parent profile is ready to receive them, so we must wait if necessary. When the parent profile is ready, we just need to push the event to the parent profile, and we're finished.