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

SOLVED

Rule is only fired if 'Send Beacon' is set to s.t() (treat data as a pageview)

andrease528381
Level 1
Level 1

We came across this issue today: We have a rule that is supposed to be triggered by the DOM Ready event together with the condition of finding a specific string in the URL. The only action is 'Set Variables' using custom code. This is followed by 'Send Beacon' and 'Clear Variables'. If we set 'Send Beacon' to s.t() all works fine. But since we want to treat the rule as hit, we would like to use s.tl() instead. However, if we do that, the rule isn't triggered. It was my understanding that this change shouldn't make a difference, but I guess I was wrong. Can someone help me to understand this behavior?

1 Accepted Solution
andrease528381
Correct answer by
Level 1
Level 1

@evolytics_brian Thanks for your reply! I checked in the Console and the rule is executed, but variables are not set in the case of s.tl(). Maybe the custom code helps with which we try to set the variables:

var path_parts = new URL(document.URL).pathname.split('/')
if (path_parts.length >= 4) 
{
  s.eVar102 = path_parts[path_parts.length - 3];
  s.eVar103 = path_parts[path_parts.length - 2];
}
else
{
  s.eVar102 = "N/A";
  s.eVar103 = "N/A";
}

 

View solution in original post

4 Replies
evolytics_brian
Community Advisor
Community Advisor

@andrease528381 - Does the rule not execute at all, or does the analytics beacon exist, but without the expected information? Any additional detail you can add would be helpful.

andrease528381
Correct answer by
Level 1
Level 1

@evolytics_brian Thanks for your reply! I checked in the Console and the rule is executed, but variables are not set in the case of s.tl(). Maybe the custom code helps with which we try to set the variables:

var path_parts = new URL(document.URL).pathname.split('/')
if (path_parts.length >= 4) 
{
  s.eVar102 = path_parts[path_parts.length - 3];
  s.eVar103 = path_parts[path_parts.length - 2];
}
else
{
  s.eVar102 = "N/A";
  s.eVar103 = "N/A";
}

 

View solution in original post

evolytics_brian
Community Advisor
Community Advisor

@andrease528381- I think the issue here is that you're not setting s.linkTrackVars to ensure the variables are included on the s.tl() call. While they're included by default with s.t(), you have to explicitly declare that they are to be included when using s.tl(). Based on your sample code, you'll need to add the following after the if/else block: 

s.linkTrackVars="eVar102,eVar103";

For additional reference:

andrease528381
Level 1
Level 1

@evolytics_brian- Yes, that was it, I didn't know that. Thanks a lot! I will further read the documentation you attached to avoid these issues in the future.