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

Injecting custom code from Target with calls to backend

Avatar

Avatar
Boost 1
Level 1
Amazi
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
Amazi
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Amazi
Level 1

14-01-2020

Hi,

 

We sometimes inject custom code (ie: offer or banner) into our website that have backend calls to display dynamic data (not Adobe related). The issue we currently have is that because the webpage and the Target injection happen async, sometimes (especially on first load in all browsers, and in IE11) Target code is injected before the page finishes loading all the JS, causing the dynamic data not to show. The only way we are able to get around this issue is to set a timeout in the Target custom code of 3+ seconds so that Target holds on injecting the code until most or all of the page JS is loaded. This is not great for performance.

 

Is there a way through Target to wait until page load is complete before Target code is injected? or can you suggest a way to get around this issue?

 

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
Level 8
gaureshk3014423
Level 8

Likes

193 likes

Total Posts

161 posts

Correct Reply

31 solutions
Top badges earned
Springboard
Validate 1
Contributor
Coach
Shape 10
View profile

Avatar
Springboard
Level 8
gaureshk3014423
Level 8

Likes

193 likes

Total Posts

161 posts

Correct Reply

31 solutions
Top badges earned
Springboard
Validate 1
Contributor
Coach
Shape 10
View profile
gaureshk3014423
Level 8

14-01-2020

I dont think target have any inbuilt functionality like this. Also setTimeout can fail in some cases like page not loaded within 3 secs. You can try using setInterval or page load event to fire your code.

Answers (0)