Install a Javascript Snippet Using GTM

Contributors

@victoriadynamicdata-agency


Business Benefits

Run JavaScript codes in your site without the help of a developer and without deploying your entire site.


Sign in into Google Tag Manager, navigate to the Tags option in the left menu, and click New to create a new tag.

  • The Tags section will be empty if you haven’t already created a container, and you will need to create your first tag.

Enter a name for the Tag in the Untitled Tag field and select Custom > Custom HTML under Choose tag type.

  • A list of available tags will be displayed, click on Custom HTML under Custom.

Paste your JavaScript code into the HTML text box.

For example, marketing snippets like the Facebook Pixel can be deployed into a website through a Custom HTML tag.

Make sure your code is placed between the <script> and </script> tags.

You can prioritize whether to fire the tag before or after another tag, and decide whether the tag will be fired once per page or once per event under Advanced Settings.

Choose a trigger to fire the JavaScript tag, save the tag, and preview the container to confirm whether the tag fires.

  • Following the previous Facebook example, choose to fire the pixel on All Pages and save the tag.