Firing DTM rules based on datalayer values

sidh19884490

15-10-2015

Hi guys,

The search is on my site doesn't generate a pageview. When a search is performed on the site, the search parameters are passed on to the digitalData datalayer, for example, when a search is successful, onsite search = success is passed on to the digitalData datalayer without using _satellite.track. Can I fire a DTM rule based on the when the digitalData datalayer  'onsite search = success'?  I need this quite urgently, so any help quickly would be much appreciated.

Many thanks

Sid

Accepted Solutions (1)

Accepted Solutions (1)

ParitMittal

14-02-2016

Hi Sid,

We offer since apology for the delayed response.

For the use case discussed above, We would recommend to use Direct Call based rules. Direct call rules are ideal for situations where you want to tell dynamic tag management exactly what is happening. Also, they are ideal when dynamic tag management cannot detect an event in the DOM, such as with Adobe Flash or Ajax call. For more information about Direct Call Based rules  Please see the following link .

https://marketing.adobe.com/resources/help/en_US/dtm/t_rules_direct_conditions.html

Thanks & Regards

Parit Mittal

Answers (9)

Answers (9)

Cleve_Young

15-10-2015

I was guessing that your page may be using some form of Ajax to return the Search results, as that is fairly common. If so then you may be able to use $( document ).ajaxComplete(function(){}) to watch for that. I don't know if there is a specific code to watch for a datalayer value to change; as an alternative you could put in some code using setInterval() to check that value every X seconds/milliseconds after the "search" button is clicked, and if it changes then fire the Direct Call rule and then clearInterval() to stop the checker. 

Rahsing

15-10-2015

Sid,

If you're unable to figure out how to write a direct call rule for your requirement, feel free to reach out to customer care and they can help you out with it.

Let me know if you're still unable to resolve this problem.

Regards

Rahul

Rahsing

15-10-2015

Hi sid,

Technically, since this is a search result that you are trying to track, you would most likely need the search to generate a page load so as to use it in a rule (since you have no other event you can associate it with).

The element tag or selector is used to specify the element in your website you are tracking

Could you give me some info on how you're defining a search = success (if possible with a snapshot)?

Regards

Rahul

sidh19884490

15-10-2015

Hi Rahul,

Thanks. Would it be an event based rule based on the data element values in the rule condition? If so, what would be the element tag or selector as it doesn't seem I can leave this field empty. Basically, is there any way to fire the rule without using this field.

Page load rule doesn't work as the search isn't generating a page load.

Regards

Sid

sidh19884490

15-10-2015

Hi Cleve,

Thanks for sharing the information. Similarly, for my case, I think I need to add some code to listen to the change in the datalayer values after the page loads and then fire the direct call rules when the condition in the datalayer value matches. But I'm not good with the code and can't find anything in the internet, which would allow me to do this in DTM. Any suggestion?

Regards

Sid

Cleve_Young

15-10-2015

In some similar scenarios, which in our case used Ajax to make the search updates, I've used DTM to include some jQuery to watch for the Ajax Success/Complete event. When that happens and the correct criteria is met it fires a direct call rule. Ideally you would have the developers include that direct call in the regular search code, but as that is not always feasible this works as a viable alternative for me.

Rahsing

15-10-2015

Hi Sid,

You can use the 'data element value' option under the conditions and then select the relevant data element to fire your rule based on datalayer values.

Kind Regards

Rahul