Create a CSS Path Variable for Click Element

At one point in the turbulent year of 2020, you might have gasped in surprise when looking at the preview interface of Google Tag Manager. No, I’m not talking about the new preview mode interface. Instead, I’m referring to how the Click Element and Form Element built-in variables would now display a CSS path string rather than the expected [object HTMLDivElement] (or equivalent). There was good and bad in this update. Read More…

Capturing the Correct Element in Google Tag Manager

Last updated 24 August 2022: The instructions in this article are no longer that useful, as you can simply use the native JavaScript Element.closest(selector) method instead of the {{Find Closest}} trick described in this article. Browser support for closest has thankfully improved a great deal since this article was originally written. Google Tag Manager provides us with a bunch of handy triggers, designed to make capturing user interactions on the website much easier. Read More…