Tips for testing / debugging triggers
Here are a few things I learned when trying to get a trigger working:
- Triggers are not fired by a page refresh. This means that you need to go to new page or reopen the browser each time you want to test a trigger being fired.
- Turn off the "Each visitor will receive this message only once" checkbox until you have finished testing (otherwise you will only see the trigger once!)
- If you want to make a backup copy of the trigger settings then switch from Visual to Developer view: you can then copy the text that defines the trigger.
- If you want to create a trigger that is similar to one you already have, then use the method in (3) to make a copy, create a new trigger and then paste the text into the Developer view of the new trigger.
- In the Developer view you can have more complex conditions. For example, the Visual view only allows "all the following conditions" (logical and) or "any of the following conditions" (logical or). In the Developer view, you can write things such as (((day of week = Monday) OR (previous visits > 3)) AND (page url contains 'zendesk'). Like this:
{
Note that this is not documented but it seems to work. You may have to use some trial and error to see what is allowed.
"event": "page_enter",
"condition": [
"and",
[
"or",
[
"eq",
"@day_of_week",
0
],
[
"gt",
"@visitor_previous_visits",
3
]
],
[
"icontains",
"@visitor_page_url",
"zendesk"
]
],
"actions": [
[
""
]
]
}
-
Great stuff Jamie!
Have you put the more advanced (5) trigger conditions to use?
-
I did, but only to work round a non-existent problem! (Due to not knowing about point 1)
-
Ha, chasing non-existing problems, been there :-)
-
Hi Jamie,
Apologies for the lack of documentation on testing triggers!
Thank you for writing this detailed tips into our community. I am sure this will benefit a lot of our users as well.
One thing I like to do when testing triggers is to use incognito/private browsing. This will provide a better testing environment and replicate what a new visitor upon your site may see.
Thanks again, and feel free to post in our community should you have other queries!
-
Private browsing. Great idea. Why didn't I think of that!
Iniciar sesión para dejar un comentario.
5 Comentarios