#GTMTips: Trigger Javascript Function Without Using a Custom HTML Tag
Last updated 9 October 2020:
customTaskupdated to a more stable version.
The Custom HTML tag in Google Tag Manager is splendid. It’s your go-to tool when you need to run arbitrary JavaScript on the webpage. Some might even use it to actually add HTML elements to the page, but I’m willing to bet running JavaScript is its most common use.
However, there’s a downside to Custom HTML tags, which is only made more apparent on single-page apps which do not clear the full page when transitioning from one state to another. Custom HTML tags are injected to the end of <body>, which means you might end up with a lot of clutter in your Document Object Model.