Two ways to deploy tags
A hard-coded tag is a script, or a call to one, written into the page templates. A developer adds it, it goes through code review and testing, it ships with the next release, and it loads in the position in the page where it was placed. Changing it means another ticket and another release. The tag has access to everything the page knows at the moment it runs, including server-rendered data, and it can be placed before anything else loads. Its behaviour is fully specified in code that can be read, tested and diffed.
A Tag Manager tag is configuration in a container. The page carries one script, the container snippet, and everything else is defined in the Tag Manager interface: which tags exist, when they fire and what data they read, usually from a data layerA structured object on a web page that passes values to a tag manager for tags to use. the developers populate. Changes are made in a workspace, tested in preview, published as a version and live within moments, with no release. Google's documentation describes the product as a way to add and update tags without modifying site code, and that sentence contains both the benefit and the risk: the people changing tags no longer need the people who own the code.
The two are not mutually exclusive. The container snippet is itself hard-coded, the data layer is written by developers, and nothing stops a site from carrying some tags in code and the rest in the container. The comparison below is about where a given tag should live.
Comparing the two
Google Tag Manager vs Hard-coded tags
| Row label | Google Tag Manager | Hard-coded tags |
|---|---|---|
| Who can change a tag | Anyone with edit and publish rights on the container | Developers, through the release process |
| Speed of change | Minutes from workspace to live | A release cycle: days to weeks |
| Control over timing | Fires on container and page events; cannot run before the container loads | Can be placed anywhere, including before any other script |
| Access to page data | Whatever the data layer and the DOM expose | Everything the template knows, including server-side values |
| Testing | Preview mode per workspace, before publishing | Unit and integration tests, staging environments |
| Change history | Versions with notes, rollback by republishing | Version control with diffs, code review, rollback by deployment |
| Performance | One asynchronous container script plus the tags it loads; cost grows with accumulation | Exactly what is written; synchronous placement can block rendering |
| Reliability | Depends on the container loading and on triggers evaluating as intended | Depends on the code being correct and the release being deployed |
| Governance | Must be built: naming, review, publish rights, audits | Inherited from engineering practice by default |
| Developer dependency | Low for tag changes; high for data layer changes | Total: every change is a ticket |
| Consent handling | Consent settings per tag, built-in checks for Google tags | Implemented by hand for every tag |
| Vendor scripts | Templates with declared permissions, or custom HTML | Pasted into templates; reviewed with the code |
| Cost | The product is free; the cost is governance time | Developer time per change |
| Typical failure | Tags accumulate and double-count; nobody knows what fires | Tags lag the business; marketing works around engineering |
Where each wins
Tag Manager wins on change velocity and on marketing ownership. A campaign that needs a new conversion event, a vendor pixel for a test, a GA4Google's event-based analytics platform. parameter added to an existing event, a trigger narrowed to one page: each is a workspace, a preview and a publish. Hard-coding the same changes puts them in a queue behind product work. Over a year, the difference in how many measurement improvements actually ship is large, and it is the reason most marketing teams adopt a container. Tag Manager also wins on consistency: one consent configuration, one data layer, one place to see every vendor, and a version history that tells you what changed when a number moved.
Hard-coding wins on control, timing and data access. Anything that must run before the container loads, such as a consent default that has to precede a hard-coded Google tag, belongs in code. Anything that needs server-rendered data the data layer does not carry is simpler in the template than in a custom JavaScript variable scraping the page. Anything engineering considers part of the product, such as error monitoring, performance measurement or A/B testing frameworks that change the page before paint, belongs with the product code and its tests. And on sites where the people who would edit a container cannot be trusted to govern it, hard-coding is the honest choice: slower, but reviewed.
On performance, neither wins by nature. A container script is one more asynchronous request; the tags it loads cost what they would cost in code. The real difference is discipline. Hard-coded tags are reviewed on the way in and tend to be few; container tags are easy to add and tend to accumulate. Either way, every tag runs in the visitor's browser, and the budget it consumes shows in the field metrics the Core Web Vitals guide describes, with interaction responsiveness and layout stability (Core Web VitalsGoogle's user experience metrics.) the ones most often hurt by third-party scripts. Treat tag count as a performance budget wherever the tags live.
Hybrid patterns
The arrangement most sites settle on is a split with a written rule. Engineering owns the container snippet, the data layer and anything that must run before the container; the container owns marketing and analytics tags; and a governance process keeps the container honest. Once the split is agreed, the tutorial on moving hard-coded tags into Tag Manager walks through the move itself without a gap or a double count.
The data layer as the contract. Developers write what happened into the data layer, following the data layer guide, and the container reads it. Marketing never scrapes the page, and engineering never needs to know which vendors consume the data. When a new event is needed, the request to engineering is a data layer change with a specification, and the tagging follows in the container.
Templates over custom HTML. The hybrid only stays safe if the container cannot become a back door for arbitrary scripts. A rule that vendor tags use gallery or custom templates with declared permissions, and that custom HTML needs the same review as a code change, keeps the control engineering gave up from turning into risk.
Governance as the condition of the arrangement. Naming conventions, one change per workspace, a second reviewer, publish rights held by a small group, version notes and a periodic audit: the container governance guide sets these out. Engineering teams that resist Tag Manager are usually resisting ungoverned Tag Manager, and the governance document is the answer to that objection.
Hard-code the exceptions and list them. A short list of tags that live in code, with the reason for each, prevents the slow drift where marketing re-adds a hard-coded tag to the container because nobody knew it was already there. The list is reviewed in the same audit as the container.
Server-side as a later step, not an alternative. Moving vendor calls to a server container changes where tags send data, not whether they are configured in Tag Manager or in code; the split above still applies.
A B2B software company draws the line
A B2B software company with a 6-person marketing team and a product engineering group of 40 has every tag hard-coded, and a backlog of 23 measurement tickets, the oldest 7 months old. Engineering's objection to Tag Manager is a previous employer's container with 300 undocumented tags. The two teams agree a split: engineering keeps the consent default, the Google tag and the error-monitoring script in code; a container holds GA4 events, the ads conversion tags and 4 vendor pixels, all via templates; custom HTML is disallowed through the container's tag-type policy; and publish rights sit with 2 named people. The data layer specification for 11 events is written in a week and shipped in one release. Over the next quarter, 19 of the 23 tickets are closed from the container without an engineering ticket, the container holds 31 entities with notes, and the two hard-coded GA4 page views that were double-counting before the migration are gone.
Common mistakes
- Choosing by default. The site has a container because an agency added one, or has everything in code because nobody asked; neither is a decision.
- Both at once. The same tag in the template and in the container is the standard double-count.
- Scraping the page instead of building a data layer. Custom JavaScript variables reading the DOM break on every redesign; the data layer is the contract that makes the hybrid work.
- Adopting Tag Manager without governance. The container engineering feared is the one with no naming convention, open publish rights and no audit.
- Hard-coding what marketing changes weekly. A release cycle for a pixel swap is a tax on every campaign.
- Putting consent defaults in the container when the Google tag is in code. Order matters; the default must precede the tag.
- Ignoring the performance budget because the tags are "just marketing". Visitors pay for every script wherever it was configured.
- Forgetting the exceptions list. The hard-coded tags nobody documented get re-added in the container.
The tags, triggers and variables guide explains the container's building blocks for anyone deciding to adopt one, and the Tag Manager hub lists the rest of the section.
