Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do not fire an event when the variable value is empty

I want to create a trigger in gtm that will not fire a tag when click url variable is empty. Is that possible? Or the other way round if it contains something

Click url, does not contain, undefined - that doesn't work

To be more precise, I've added a tag that tracks outbound links, but excluding my own domain isn't enough, because it also sends events when someone clicks a link that doesn't contain a target url like adding a job offer to shortlist.

like image 251
Jack Avatar asked Sep 05 '26 11:09

Jack


1 Answers

You can create a trigger that only fires when a variable has a value by checking that the value does not match RegEx ^$. The RegEx ^$ will check for an empty string value, which is not what we want.

enter image description here

like image 81
MShipman Avatar answered Sep 08 '26 17:09

MShipman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!