Custom code (async) tag

Tag Manager

A custom code (async) tag lets you insert custom scripts, HTML or CSS styles into 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 your tag and select the following type: Custom code (async).
  5. In Tag code, type your code.
    Custom asynchronous tag in Tag Manager in Piwik PRO

    Note: Place your JavaScript code between <script> tags.

    Tip: Our HTML editor includes a built-in linter and syntax checker, so you don’t need to use external editors.

  6. (Optional) Start typing {{ and a list of available variables will appear.
    Custom asynchronous tag in Tag Manager in Piwik PRO

    Note: Variables are dynamically replaced with their current value each 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 only fire 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’ve turned on the Do-Not-Track feature in their browsers or who’ve opted out of tracking using our opt-out form.
  9. Enable document.write is turned off by default. Turn it on only if your tag needs it.
  10. In Flight dates, set the date and time when the tag will fire.
  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 Save.
  14. Click Save to save the tag.
  15. Test your tag in debug mode.
  16. When you’re happy with how the tag works, click Publish.
  17. All done!

Was this article helpful?

Technical support

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

Back to help center