How to Install a Custom Script Tag Using Google Tag Manager (GTM)
Last updated: June 6, 2025
Overview
This article provides step-by-step instructions for implementing a custom <script> tag on a website using Google Tag Manager. The focus is on executing the script only on a designated URL.
Accessing Google Tag Manager
Navigate to: https://tagmanager.google.com
Log in with your credentials
Select the correct GTM container for your website
Creating a New Custom HTML Tag
In GTM, go to 'Tags' in the left-hand menu.
Click 'New' to create a tag.
Name the tag (e.g., 'Custom Script for Checkout Page').
Under 'Tag Configuration', choose 'Custom HTML'.
Paste your script code.
Example:
<script>
console.log('This script runs only on the checkout page.');
</script>
Configuring Head-Like Behaviour
Check 'Support document.write' if needed
Under 'Advanced Settings'
Set 'Tag firing options' to 'Once per page'
Assign a high 'Tag firing priority' (e.g., 999)
Note: These steps simulate <head> loading behavior since GTM inserts scripts in the <body> by default.
Creating a Trigger for a Specific URL
In 'Triggering', click to add a new trigger.
Select 'Page View' as the type.
Choose 'Some Page Views'.
Define the condition:
Variable: Page URL
Condition: equals
Saving and Publishing the Tag
Click 'Save' after assigning the trigger
In the workspace, click 'Submit'
Optionally name and describe the version
Click 'Publish' to activate
Verification Methods
Use the Google Tag Assistant extension.
Check the 'Page Source' to confirm script presence.
Use the browser's Developer Console for log inspection.
Tips for Success:
Need Assistance?
Contact our Support team if you have any questions or issues!