Copy the following snippet and paste it immediately after the opening tag on every page of your website, replacing GTM-XXXX with your container ID:
Many tag management operations can be achieved by just doing the basic code installation, but if you'd like to have finer grain control over tag events or data, you may want to use some customization using our asynchronous methods.
Note: The Google Tag Manager snippet must be placed directly in the page that you intend on tracking. Placing it in a hidden iframe or deploying it within another tag management system will prevent certain tags from accurately tracking the parent page.
For more information about how to migrate your current on-site tag configuration to GTM, we have additional articles on:
Using a Data Layer
Migrating tags to Google Tag Manager
To further customize your installation, please review the following additional resources:
Adding Events and Variables — Learn about how to use Google Tag Manager to collect dynamic data and to track events.
Multiple Domains — Learn about best practices for implementing Google Tag Manager across multiple domains.
Renaming the Data Layer — Under certain circumstances, you may want to alter the name of the Data Layer.
Security — Learn about additional features of Google Tag Manager that may help site-owners with advanced security concerns.