DTM | Data layer fires after DOM ready

Avatar

Avatar

chads47842055

Avatar

chads47842055

chads47842055

15-10-2015

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

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Jeff__Chasin

Employee

Avatar

Jeff__Chasin

Employee

Jeff__Chasin
Employee

15-10-2015

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.

Answers (3)

Answers (3)

Avatar

Avatar

chads47842055

Avatar

chads47842055

chads47842055

15-10-2015

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

Avatar

Avatar

Jeff__Chasin

Employee

Avatar

Jeff__Chasin

Employee

Jeff__Chasin
Employee

15-10-2015

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

Avatar

chads47842055

Avatar

chads47842055

chads47842055

15-10-2015

Jeff,

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

chad