Highlighted

Experience custom code runs twice

stephent5693770

01-02-2018

I created an activity in Adobe Target that has an Experience that runs 100% to test custom code.  I checked off the box to let the code run in the head.  The custom code is a jQuery document ready that then makes a requireJS call (asynchronous) to load another JS file.  Once that file loads, it executes a console.log message.

I noticed that every time this experience runs, this custom code runs twice, so the console message is shown twice.

I found another thread here dated April 2016 where Adobe staff said there was a bug in Adobe Target, and it would get fixed in May 2016.

Extra link rendering after recent Target updates

It seems this problem still exists for Ajax calls in custom code.  Is there still a problem in Adobe Target?  I had to employ the workaround in that other thread, but I am not satisfied that I have to use this workaround.

Replies

Highlighted

will_lanni

07-06-2019

We have same issue.

just upgraded to at.js 2.1.0

We have an A/B test.

All the code does is run a console.log.

We see two console logs trigger.

In other properties where we use at.js 1.x we do not have this problem.

Highlighted

will_lanni

13-06-2019

I will need to get permission to set up a live activity on production so I can share it. I'll post back here when I get that going.

Highlighted

will_lanni

13-06-2019

*headslap* Surebee we won't be able to provide a test until target has been implemented in the environment we're working in and released into production. I'll need to come back to this when we've released.

However, I can say that we implemented the fix from that old thread posted by the OP, and it cut out the second log.

Anyway, I'll set a reminder to come back to this when we have a production version to show.

Highlighted

surebee

Employee

14-06-2019

Right, understood @will.lanni.  I'd like to try and see what the issue is, even though we have a workaround . I will watch for a response from you when you have a production version.

Have a great weekend!

Highlighted

will_lanni

03-07-2019

OK, Surbgupt (hey you changed your username! ), we've deployed our Target installation into production.

Our test is set up as an A/B. Both experiences purely just drop a console.log into the developer console. The default console log is 'tgt-dflt', and the test is 'tgt-tst'.

https://www.endicia.com

If you look, you'll see the little (2) next to the console log, indicating it triggered twice.target-triggers-twice.png

Hope this helps! Let me know if you need any more information.

Highlighted

gaureshk3014423

04-07-2019

hi, will.lanni

Looks like target is getting fired twice on your webpage which will cause all modification hit twice on a page as you can see in following screenshot.

Global Mbox carries and hits all modifications in JSON format on a page when your page loads, here in your case in first hits target loads your custom code and again in the second hit, it'll load same custom code since you are firing mbox twice on a page.

1784553_pastedImage_8.png

thanks,

Gauresh Kodag.

Highlighted