Google tag gateway for advertisers: Load Google scripts first-party
Stay organized with collections
Save and categorize content based on your preferences.
This document is for developers who use server-side tagging and want to serve
Google scripts in a first-party context.
Google tag gateway for advertisers lets you load Google scripts, such as gtm.js,
directly from your first-party infrastructure instead of from Google's servers.
This lets you serve data within a first-party context either through your
tagging server or through a CDN.
Before you begin
This guide assumes that you have done the following:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-28 UTC."],[[["This article guides developers on serving Google scripts like gtm.js or gtag.js from their own servers using server-side tagging for a first-party data context."],["Before starting, ensure you have a server container in Tag Manager, a tagging server setup, and a configured custom server domain."],["Implementation involves configuring the client to load Google scripts through your server, updating the script source domain to your server, and verifying the script source using browser developer tools."],["If using consent mode, you can further enhance control by setting up region-specific tag behavior after completing the implementation."]]],["Developers using server-side tagging can load Google scripts (gtm.js, gtag.js) from their own server for a first-party context. This requires setting up a server container, a tagging server, and a custom server domain. Steps involve configuring the client to load scripts through the server and updating the script source URL on the website to point to the custom server. Verification includes checking the browser's developer tools to confirm that `gtm.js` loads from the custom server, not Google's.\n"]]