Custom code (async) tag

Tag Manager

The custom code (async) tag (custom asynchronous tag) lets you insert custom scripts to your website’s code.

To set up the tag, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Tags.
  3. Click Add a tag.
  4. Name the tag and select the following type: Custom code (async) (custom asynchronous tag).
  5. In Tag code, type your code.
    Custom asynchronous tag in Tag Manager in Piwik PRO

    Tip: If you want to execute JavaScript, you need to include <script> <script>.

    Tip: The HTML editor has a built-in linter and syntax. They help you debug the JavaScript code, and you don’t need to use external editors.

  6. To use variables in Tag code, start typing {{ and a list of available variables will show up.
    Custom asynchronous tag in Tag Manager in Piwik PRO

    Note: A variable will be dynamically exchanged to its actual value at any time your script is executed.

  7. In Advanced tag settings, choose Consent type. Set it up if you use a consent form on your site. This tag will fire only for visitors who accept the selected consent type.
  8. Respect opt-out and DNT is turned on by default. Leave it as is, if you want to respect visitors who set Do-Not-Track in their browsers, or visitors who opt out of tracking using our opt-out form.
  9. Enable document.write is turned off by default. Toggle this option, if your tag needs document.write.
  10. In Flight dates, set the date and time when the tag is fired.
  11. In Tag triggers, click Add a trigger or Choose existing trigger to set up a trigger for your tag.
  12. Adjust trigger conditions.
  13. When you’re done, click OK for the trigger.
  14. Click Save for the tag.
  15. Test your tag in debug mode.
  16. When you’re happy how the tag works, click Publish.

Was this article helpful?

Technical support

If you still have some questions, visit our community.
There’s always someone ready to help!

Back to help center