Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Including Adobe DTM asynchronous in AngularJS

Avatar

Avatar
Validate 1
Level 1
kevingobert
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
kevingobert
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
kevingobert
Level 1

18-08-2018

We have a platform developed with AngularJS. The platform is the same for all our customers. We must include Adobe DTM only for a client.

I sometimes have external scripts that aren't loaded. Do you have a better way to do it?

here my code :

var adobedtm = '//assets.adobedtm.com/5249...abe2e5/satelliteLib-2d8560...eb5937-staging.js';

if( window._env.environment === 'production' ){
  adobedtm
= "//assets.adobedtm.com/5249...abe2e5/satelliteLib-2d8560...eb5937.js"
}

$
.getScript('//cdnjs.cloudflare.com/ajax/libs/postscribe/2.0.8/postscribe.min.js', function (data, textStatus, jqxhr){
  postscribe
(document.body, '<script src="' + adobedtm + '" type="text/javascript"><script type="text/javascript">_satellite.setDebug(true);</script><script type="text/javascript">_satellite.pageBottom();</script>');
});

https://i.stack.imgur.com/NbNTI.png

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
StewSchilling
MVP

Likes

339 likes

Total Posts

276 posts

Correct Reply

85 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Establish
Contributor
View profile

Avatar
Springboard
MVP
StewSchilling
MVP

Likes

339 likes

Total Posts

276 posts

Correct Reply

85 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Establish
Contributor
View profile
StewSchilling
MVP

21-08-2018

Have you considered using Launch instead of DTM?

DTM is full of document.write calls which is OK if you're using DTM in a supported way (i.e. Header embed synchronously loaded in the HEAD, and pageBottom() synchronously called just before the closing BODY tag).   There are certain expectations that DTM has regarding when it is being invoked within the lifecycle of a page being rendered.  Your implementation does not support DTM's expectations.

Launch, however, supports async embed and does not require the pageBottom call.

If you absolutely can't move to Launch, I'd suggest looking at the contents of each of these scripts and seeing why they cannot be loaded after DOM ready.  If they are "sequential JS" try changing to "non-sequential JS". 

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
kevingobert
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
kevingobert
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
kevingobert
Level 1

18-08-2018

And I can’t include for all our clients. I forgot to put the screenshot.

NbNTI.png