Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.
SOLVED

Event based rule and direct call rule

Avatar

Level 2

Hello,

I've set up a rule that based on the change of a data element (page name) sets a event (search). Because the website is an SPA I've created direct rules for measuring 'page loads'. The problem is that the search event is being set in multiple images (in a custom link image and in the 'page load' image that is triggerd by the direct call) so that i'm recording 3 searches instead of one. 

The downside of the direct rules is that I can't use conditions so I do need to make use of a event based rule. I would like to set the event the same call as the direct rule or directly after. Does anyone knows what is going and if there is a solution?

Regards,

 

Guido

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Guido ,

We will recommend using Event Based rule to track the page load by making use of the dataelementchanged rule as it offers more flexibility.

Thanks & Regards

Parit Mittal

View solution in original post

10 Replies

Avatar

Employee

Hi Guido,

In my understanding the event is being fired in multiple images because the s.events is not cleared off from the 's' object as it is a SPA. You can try clearing off the variables using s.clearVars() after the specific call is done firing (or before next call is fired) to avoid such issues.

Below is an article on the function clearVars() for your reference:

https://marketing.adobe.com/resources/help/en_US/sc/implement/function_clearVars.html

Here is a page which explains use of this function with AJAX implementations:

https://marketing.adobe.com/resources/help/en_US/sc/implement/impl_ajax.html

 

~Kaushal

Avatar

Level 2

Hello Kaushal,

Thanks for the documentation. Is there a way to use the clearvar function in combination with direct call rules, without having to populate the evars and props in custom script, but just by using the standard template?

Regards,

 

Guido

Avatar

Level 10

Hi,

Direct Call Rules don’t provide a great place to use something like s.clearsVars(). There are some potential work-arounds, but none are ideal.

Thanks & Regards

Parit Mittal

Avatar

Level 4

Hi,

I was looking at the latest DTM webinar (https://my.adobeconnect.com/p7y362elp19) and linked to you comment above i don't really understand how the presenter was able to use s.clearVars() in both the condition as well as in the custom javascript. As far as i know i was never able to access the s object in both of these section. s object is only accessible when using the editor under the analytics tab / container of a rule.

Would it be possible to confirm if the above will be available in the next release or how did the presenter did it?

Thanks

Jerome

Avatar

Level 10

Hi Jerome ,

It some time depends on how you deploy Adobe Analytics Tools. DTM App measurement library got updated in previous releases and if you do not update the library you might not be able to use it . 

Please update your DTM library to latest version and check if it works for you.

Thanks & Regards

Parit Mittal

Avatar

Level 4

Hi Parit,

Thank you for your response.

I am on the latest Analytics version 1.6.2 when running my tests and the s object is still only accessible in the editor of the analytics section of a rule.
It cannot be accessed when inside a condition and / or within the custom javascript part of the rule.

Have you tried it on your side?

Thanks

Avatar

Level 2

Thanks Parit,

I think I'm going to use an EBR to track the page load by making use of the dataelementchanged rule. This seems a more flexible solution and it allows me to add to s.clearvar() function to the conditions as custom code. I've also considered the pushstate hashchange trigger, but this can cause timing issues, because the dataLayer has to be loaded before the rule executes.

What would you recommend? 

Regards,

 

Guido 

Avatar

Level 10

Hi Jerome ,

Can you please share your DTM account details in a private message so that we can look into the issue at our end.

Thanks & Regards

Parit Mittal

Avatar

Correct answer by
Level 10

Hi Guido ,

We will recommend using Event Based rule to track the page load by making use of the dataelementchanged rule as it offers more flexibility.

Thanks & Regards

Parit Mittal

Avatar

Level 4

Hi Parit,

Just wanted to follow up on the above.

I have added you in my DTM and sent you a private message. Were you able to look into it?

Thanks