Check your RegEx: You're not escaping the ?
.
secure/billinginfo\?prodCode=[B,P]
Also, try using {{path}}
macro instead of {{url}}
macro.
Pergunta
I am having a tricky time with Google-Tag-Manager.
I have a form on a particular page that I'd like to track successful submissions off.
The URL where the form lives has two variations:
https://example.com/secure/billinginfo?prodCode=B
https://example.com/secure/billinginfo?prodCode=P
I have a Form Submit Listener tag that fires on all pages.
I've now created a new tag to use the form listener:
Universal Analytics;
Track Type: Event;
Firing Rules: {{event}} = gtm.formSubmit and {{url}} matches regex https://example.com/secure/billinginfo?prodCode+
So I just added a regex "+" for the last two characters of each variant of the URL, which ends in either "=B
" or "=P
". But the tag did not fire.
I also tried simply using {{url}} contains /secure/billinginfo?prodCode
but that also did not work.
What would be the best way to set up a rule to fire the tag when either version of the URL is shown?
Solução
Check your RegEx: You're not escaping the ?
.
secure/billinginfo\?prodCode=[B,P]
Also, try using {{path}}
macro instead of {{url}}
macro.