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

Why to use a piece of code to prevent multiple server calls in iframe tracking

Avatar

Avatar
Ignite 1
Level 2
sundhara_m
Level 2

Likes

4 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 1
Boost 3
Boost 1
View profile

Avatar
Ignite 1
Level 2
sundhara_m
Level 2

Likes

4 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Ignite 1
Validate 1
Boost 3
Boost 1
View profile
sundhara_m
Level 2

09-08-2018

Hi Team,

I am currently using the below piece of code which was provided by Adobe to prevent multiple server calls in iframe tracking,

var isInIframe = (parent !== window)
if(isInIframe ){
return false;
}else{
return true;
}

Can anyone explain me that how this code is preventing the duplication of server call?

Thanks in Advance!

Sundhara Vadivu M.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
StewSchilling
MVP

Likes

342 likes

Total Posts

278 posts

Correct Reply

85 solutions
Top badges earned
Coach
Give Back 25
Springboard
Bedrock
Validate 1
View profile

Avatar
Coach
MVP
StewSchilling
MVP

Likes

342 likes

Total Posts

278 posts

Correct Reply

85 solutions
Top badges earned
Coach
Give Back 25
Springboard
Bedrock
Validate 1
View profile
StewSchilling
MVP

12-08-2018

By "Server Call", I assume that you are referring to Adobe Analytics beacons.

This code tests to see if it is running within an iframe.  It could be shortened a bit as such:

if (parent !== window) {

    //we are in an iframe

     return false;

} else {

     //we are NOT in an iframe

     return true;

}

This code alone does nothing but return a boolean value (true or false).   I can think of a couple places where this code _could_ go within DTM to suppress a server call (Adobe Analytics beacon).

1) If this code were placed in a DTM custom condition, it would keep the rule from firing if DTM has been loaded in an iFrame.

2) If this code were placed in the AA custom code section of a DTM rule, it would keep the beacon from being sent if DTM has been loaded in an iFrame.  Note that within the AA custom code section of a DTM rule, returning false has the same effect as setting s.abort=true.

Where do you have this code implemented?

-Stew

Answers (0)