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:
- Go to Menu > Tag Manager.
- Navigate to Tags.
- Click Add a tag.
- Name your tag and select the following type: Custom code (async).
- In Tag code, type your code.
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.
- (Optional) Start typing {{ and a list of available variables will appear.
Note: Variables are dynamically replaced with their current value each time your script is executed.
- 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.
- 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.
- Enable document.write is turned off by default. Turn it on only if your tag needs it.
- In Flight dates, set the date and time when the tag will fire.
- In Tag triggers, click Add a trigger or Choose existing trigger to set up a trigger for your tag.
- Adjust trigger conditions.
- When you’re done, click Save.
- Click Save to save the tag.
- Test your tag in debug mode.
- When you’re happy with how the tag works, click Publish.
- All done!
Note: See an example of a “Hello, world!” popup published using this tag in our guide.