Promises and JS Timing

Avatar

Avatar
Validate 1
Level 2
michaelk6714623
Level 2

Likes

2 likes

Total Posts

8 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
michaelk6714623
Level 2

Likes

2 likes

Total Posts

8 posts

Correct reply

2 solutions
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
michaelk6714623
Level 2

03-03-2017

Hi All

I have an issue in my implementation where the pageview is being called before my datalayer is populated, throwing up an error. I have implemented a custom code to fire rather than using the standard implementation within DTM.

What are my options to delay the timing of the pageload call? Can DTM handle Javascript Promises? If not, what other options can I use? I want the pageview to be fired after the datalayer has been populated.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,338 posts

Correct reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

339 likes

Total Posts

2,338 posts

Correct reply

819 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile
jantzen_belliston-Adobe
Community Manager

06-03-2017

Hi Michael,

DTM should be able to handle anything that you load prior to DTM loading. For example, if you loaded jQuery before DTM, you should be able to use jQuery. 

As for the data layer, it is best to split it with all the static data (ex: product data on the product page) available during page build coming before DTM and all data coming via ajax can be added after page body load (ex: pricing data on product page).

Additionally, I'd suggest a look through the load order documentation. There may be various events that you can utilize to accomplish your goals. If all else fails, you could use direct call rules to fire the beacons from the page.

 

Cheers,
Jantzen

Answers (0)