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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Experience custom code runs twice

stephent5693770
Level 2
Level 2

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.

7 Replies
will_lanni
Level 2
Level 2

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.

surebee
Employee
Employee

Hi @will.lanni,

Do you have a sample link I can replicate the issue on?

Thanks!

will_lanni
Level 2
Level 2

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.

will_lanni
Level 2
Level 2

*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.

surebee
Employee
Employee

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!

will_lanni
Level 2
Level 2

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.

gaureshk3014423
Level 9
Level 9

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.

will_lanni
Level 2
Level 2

Thank you Guaresh, I'll open a bug and see if we can figure out what's going on there. Liked/marked helpful.

surebee
Employee
Employee

Hi @will.lani,

Apologies for the delay here!

Thank you for providing this URL, were you able to set up a Client Care ticket?

Either way, I took a look at the URL and see the following:

calls.png

Could you provide more details on what the global-mbox.js file does?

Thanks!