문제

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?

도움이 되었습니까?

해결책

Check your RegEx: You're not escaping the ?.

secure/billinginfo\?prodCode=[B,P]

Also, try using {{path}} macro instead of {{url}} macro.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top