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?
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?
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.
Have you tried it on your side?
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
Would it be possible to confirm if the above will be available in the next release or how did the presenter did it?
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?
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:
Here is a page which explains use of this function with AJAX implementations: