Go Back

Custom asynchronous tag template

September 24, 2018

Tag Manager makes it possible to easily create tags without adding them directly to your website. All you need is just to specify how and when the tag should fire.

As you may already know, there are two types of tags: asynchronous and synchronous – to find more about differences between these two, take a look at the linked article.). If you want to create an asynchronous tag that is not covered by one of the built-in tag templates, select Custom HTML tag option and enter the tag name.

With custom tags you are not limited to Piwik PRO Tag Manager template library – you can implement any tool or tag desired, including custom scripts and tools you have written yourself. Therefore, it gives you the endless marketing possibilities.

To create your Custom HTML tag you need to paste the snippet code into the Tag HTML Code section. It will be injected to the website code the moment the given Custom HTML tag is triggered. To include the HTML code you can just type it in. If you want to execute JavaScript, you need to include regular <script></script> tag and your script within it.

The HTML editor has embedded linter and syntax which helps debug your JavaScript code, so you don’t need to copy it over to an external editor. It also allows you to use Variables, both basic and custom by simply clicking one of the Variables on the right to insert it into your code. They will be dynamically exchanged to their actual values at any time your script is executed. Thanks to this, you can cover more scenarios with a single tag, since you can make it interpret different variable values.

Advanced tag settings

Tag Type – These settings are available for all the tags in Piwik PRO Tag Manager. They apply when the GDPR Compliance setting is turned on for a given website. Take a look how to turn it on here.

After turning it on, you need to pick the tag type. It can be either Does Not Require Consent, Analytics, A/B Testing and Personalization, Conversion Tracking, Marketing Automation, Remarketing, User Feedback or Custom Consent type.

Every tag type except the “Does not require consent” will require visitor’s consent to fire.

Respect visitor privacy – by default, this option is marked in order to respect your visitors’ privacy preferences either expressed by selecting the “Do not track” option in their web browser and/or explicitly opting-out from being tracked. You may change it according to your preferences.

Do not fire in the Debug Mode – once this is ticked, the tag will not be fired in the debug mode. Why would you need to do this? Sometimes you may have tags that are connected with some display CPC campaigns and you simply do not want to waste money when you’re doing some testing.

Also, for Custom HTML tag you can choose the “Enable document.write” option if the tag needs the “document.write” feature.

Tag Triggers

To fire your tag, you need to associate it with a trigger. By standard, you can use the “Click” trigger that is firing whenever a particular click ID is clicked but feel free to experiment with other triggers as well. Learn more about the triggers here.

Set tag status

By default, tags are active. It means the tag will be fired after publication (if conditions are met). You can turn off your tag by changing status to “Inactive”.
Please note publication is required to make your changes live.
Tag status is also displayed on tags list:

  • green dot – tag is active (or will be active after publication)
  • red dot – tag is inactive (or will be inactive after publication)

After you have your Custom HTML tag properly configured click on the save button and publish it in order to make it live.