Expand my Community achievements bar.

SOLVED

DTM | Data layer fires after DOM ready

Avatar

Level 2

In our DTM implementation, we're using an old hosted s_code alongside DTM. We're using a data layer throughout the site, but on our CQ (content) side, the data layer population is based on an AJAX call that doesn't happen until DOM Ready - by that time, DTM has already fired.

My pageload rule is capturing everything on our commerce side without incident, but the CQ side will not pass the data in the data layer. We tried delaying the pageBottom call, but that just created 2 image requests. Moving the pageload from Bottom to Onload prevented any variables configured via DTM to pass.

Has anyone run into anything similar?

Thanks,
Chad

 

1 Accepted Solution

Avatar

Correct answer by
Employee

Chad, for Ajax sequences, you can include a call to 

_satellite.track('ruleID'); 

to trigger data collection at the precise point in your Ajax code when you know the request object will be complete. In other words, you'll pick up the data from the data layer when it's available, and set your Analytics variables in the Direct Call Rule.

View solution in original post

4 Replies

Avatar

Correct answer by
Employee

Chad, for Ajax sequences, you can include a call to 

_satellite.track('ruleID'); 

to trigger data collection at the precise point in your Ajax code when you know the request object will be complete. In other words, you'll pick up the data from the data layer when it's available, and set your Analytics variables in the Direct Call Rule.

Avatar

Level 2

Jeff,

If we implement this way, would we run the risk of double tracking on the page? 

chad

Avatar

Employee

Hey Chad, does your entire data layer populate after the load event on every page of your site?

You can avoid double beacons with a 

return false;

in the Adobe Analytics section of a Page Load Rule, in the Custom Code editor. This prevents Adobe Analytics from firing the page load beacon on that page. Then, in your JavaScript/3rd Party Tags section, you can add a call to 

_satellite.track(direct-call-rule-name);

and in the body of the Direct Call Rule, make your variable assignments.

Obviously, this approach doesn't scale well, so if your entire data layer is only populated after the load event, there are better overall solutions.

Avatar

Level 2

Jeff,

The entire data layer does not populate after the load event on every page. Some of the data layer is loaded earlier and is being collected just fine. We have a content side of the site (CQ) and a commerce side. The commerce side seems to create the data layer variables and pass them ok. The CQ side does not.

Chad