Expand my Community achievements bar.

SOLVED

Timing of ACDL AdobeDataLayer?

Avatar

Level 4

Please correct me if I'm wrong. We are using the ACDL extension, which will automatically initialize the adobeDataLayer. So, the web application developers only have to worry about initializing the data layer, if they are adding some data before the Web SDK code loads. If they are only doing a "push" they obviously need to make the call after the Web SDK code loads. So, would it be a Best Practice to just have them initialize the adobeDataLayer regardless before the Web SDK code loads?

 

Thanks!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @MichaelJo13 

the beauty of the ACDL is that - like with GTM's "window.datalayer" - your developers can initialize the "window.adobeDataLayer" and push data and events to it at any time before Launch is loaded.

 

window.adobeDataLayer = window.adobeDataLayer || [];

// push some data to be present in the computed state
window.adobeDataLayer.push({
  "hello": "world",
  "foo": {
    "bar": 1
  }
});

// push a specific event
window.adobeDataLayer.push({
  "event": "woohoo",
  "eventInfo": {
    "bla": "blub"
  }
});

// async loaded Launch ready will process whatever has been pushed so far

 

This is best practice to avoid losing tracking calls. As soon as Launch and the extension loads, it will automatically enhance the previous definition with functions like getState() 

 

Hope this answers your question 

Cheers from Switzerland!


View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi @MichaelJo13 

the beauty of the ACDL is that - like with GTM's "window.datalayer" - your developers can initialize the "window.adobeDataLayer" and push data and events to it at any time before Launch is loaded.

 

window.adobeDataLayer = window.adobeDataLayer || [];

// push some data to be present in the computed state
window.adobeDataLayer.push({
  "hello": "world",
  "foo": {
    "bar": 1
  }
});

// push a specific event
window.adobeDataLayer.push({
  "event": "woohoo",
  "eventInfo": {
    "bla": "blub"
  }
});

// async loaded Launch ready will process whatever has been pushed so far

 

This is best practice to avoid losing tracking calls. As soon as Launch and the extension loads, it will automatically enhance the previous definition with functions like getState() 

 

Hope this answers your question 

Cheers from Switzerland!


Avatar

Administrator

@MichaelJo13 Did you find the suggestion helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Level 4

It was helpful.

Thanks!

Avatar

Level 4

Thank you!

Avatar

Level 9

@MichaelJo13  yeah it is best practice to data layer ready before loading web SDK