1

Built-In {{Click Url}} Variable in GTM is returning www.facebook.com/tr and not the href or action value of the click. What could be going wrong?

5
  • That FB URL is a tracking pixel URL. developers.facebook.com/docs/facebook-pixel/advanced Are you using a FB tracking pixel on your page? Aug 5 at 11:17
  • Yes, we are using FB pixel for tracking Aug 5 at 17:29
  • If you try taking it out as a test, does the problem go away? Aug 5 at 17:45
  • yes, initially it shows undefined but works as we start clicking around. But we can't get rid of FB pixel that's business critical Aug 5 at 18:17
  • Hopefully somebody here will be able to tell you why Facebook tracking and Google tag Manager click tracking are interfering with each other. Aug 5 at 18:21
0

Okay, you can definitely track the clicked link, but you will have to write some custom code for it.

  1. Make a customJS variable.
  2. In it, you have access to your {{Click Element}}, therefore you can do something like: return {{Click Element}}.getAttribute("href");
  3. Or get any other attribute. Also, since it's JS now, you can get whatever is in DOM at the time of the click.
  4. Now you can use your variable to set the label for your click event.

Built-in variables in GTM are ok, but there are plenty of cases when they don't work due to no fault of GTM. In the vast majority of these cases (like 99.9%), however, you can still tackle it with JS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.