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.
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.
*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.
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'.
If you look, you'll see the little (2) next to the console log, indicating it triggered twice.
Hope this helps! Let me know if you need any more information.
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.