Custom HTML replaceable by native GTM template
Custom HTML implementations exist for platforms that have native GTM tag templates available.
Summary
- rule_id —
replaceable-custom-html - purpose — Detect Custom HTML tags implementing functionality available as native GTM (Google Tag Manager) tag templates
- effect — Custom HTML tags bypass built-in consent enforcement and require manual updates when vendor APIs change
- layer — container
- reversibility — non-destructive
What fires this
The rule iterates active Custom HTML tags and tests each tag's code against eleven platform-specific regex patterns. Matches are: Facebook/Meta pixel init (fbq('init'), Facebook/Meta event calls (fbq('track'), LinkedIn Insight Tag (_linkedin_data_partner_id), Google Ads conversion via gtag('event','conversion'), Hotjar (hotjar or hj( with hjid also present), TikTok (ttq.load), Snapchat (snaptr(), Reddit (rdt(), Twitter/X (twq(), Pinterest (pintrk(), and Microsoft Clarity (clarity( with clarity.ms also present). Each matching tag is returned with a specific suggested replacement. Facebook event-only calls (fbq('track') are flagged with a migration note: the init tag must move first. Paused tags are excluded.
Why it matters
Native GTM templates — from Google or the Community Template Gallery — integrate with Consent Mode automatically. A Custom HTML tag carrying the same pixel does not. It fires regardless of consent state unless you add manual checks. Templates also receive vendor-pushed updates; a Custom HTML tag stays frozen at the API version the developer copied. When a vendor changes their snippet, the Custom HTML tag silently sends the wrong payload. Replacing with a native template removes both failure modes without data loss.
Before / after
// Custom HTML tag: TikTok Pixel
!function (w, d, t) {
w.TiktokAnalyticsObject=t;
var ttq=w[t]=w[t]||[];
ttq.load('AAABBBCCC111');
ttq.page();
}(window, document, 'ttq');
Tag type: TikTok Pixel (Community Template Gallery)
Pixel ID: AAABBBCCC111
Trigger: All Pages — Page View
Consent settings: ad_storage (auto via Built-In Consent)
Remediation
- Open each flagged tag and note the platform and the pixel or account ID in the code.
- In GTM, go to Tags → New → Discover More Templates and search for the suggested template name.
- Create a new native tag. Enter the same account ID or pixel ID from the Custom HTML tag.
- Apply the same firing trigger the Custom HTML tag uses.
- Verify consent settings on the native tag — most ad templates activate built-in consent automatically.
- Run GTM Preview with both tags active. Confirm identical network requests to the vendor endpoint.
- Pause the Custom HTML tag and publish the container.
- After one reporting cycle confirms data continuity, delete the paused Custom HTML tag.
Metadata
- Severity
- medium
- Tier
- optimization
- Category
- quality
- Layer
- container
- Version
- 1
- Effort
2hr(about 2 hours)- Reversibility
- non-destructive
See also
- Quality rules — other rules in this category
- Health score — how this rule contributes to the score
- Rules catalog — browse all rules
Examples
curl https://developer.tagmanifest.com/v1/evaluate-rule \
-H "Authorization: Bearer $TM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rule_id":"replaceable-custom-html","url":"https://example.com"}'
User: Run replaceable-custom-html on https://example.com
# Tool call
{
"tool": "evaluate_rule",
"arguments": {
"rule_id": "replaceable-custom-html",
"url": "https://example.com"
}
}