agentleFS
datnpqdatnpq/gskill/skills/tag-manager/SKILL.md

tag-manager

Skill0 starsChanged 48 days agoMITView on GitHub

Decide between direct gtag and Google Tag Manager, audit an existing GTM container or Google tag setup on a live site (which IDs fire, which tags scrape the DOM, duplicate configs), and set up GTM safely when it is warranted. Use for "Tag Manager", "GTM", "gắn thẻ", "Google tag", or when a site's tracking behaves inconsistently.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Look for duplicate configs (GA4 configured both in GTM and hard-coded → double page views) and DOM scraping (Custom JS variables that read …

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Tag Manager / Google tag

Choose the simplest thing that works

SituationUse
You own the code, 1–2 destinations (GA4 + Ads)Direct gtag in the layout. Events from the server. Reviewable in git, testable.
Marketing needs to add pixels without deploys; many vendorsGTM, with events pushed to dataLayer by the code (not scraped).
No code access (hosted builder)GTM or the builder's native Google integration.

GTM is not "more professional"; it's another place where tracking can silently break and where nobody reviews changes. Don't add it to a codebase that already emits clean events.

Audit a live site

In a real browser (not curl — bot protection hides the tags):

  1. View source / DevTools → find googletagmanager.com/gtag/js?id=… and googletagmanager.com/gtm.js?id=GTM-…. Note every ID.
  2. Console → run ${CLAUDE_PLUGIN_ROOT}/scripts/check_gtag.js. It lists config calls, events already pushed, and flags page_location values that carry query strings.
  3. Look for duplicate configs (GA4 configured both in GTM and hard-coded → double page views) and DOM scraping (Custom JS variables that read "Amount: …" text to build a purchase value). Replace scraping with a dataLayer.push from the server-rendered page:

    dataLayer.push({ event: 'purchase', ecommerce: { transaction_id: 'order-123',
      value: 160000, currency: 'VND', items: [/* … */] } });
  4. Tag Assistant (tagassistant.google.com) confirms which destinations receive hits.

GTM setup, if warranted

  • One container per site. Publish with a version name and notes ("GA4 purchase from dataLayer").
  • Google tag (GA4) with the measurement ID; set page_location via a Custom JS variable that applies the same whitelist as conversion-tracking §1 (keep gclid/utm only).
  • Conversion Linker tag on all pages (for Ads).
  • Triggers on custom events (purchase, sign_up), never on "Page View of /thank-you" when a server event is available.
  • Consent: if the site serves EU/UK users, add Consent Mode v2 defaults before any tag.

Hand-off note

Record, in the repo docs, every ID (GTM-, G-, AW-), which account owns it, and which event feeds which conversion action. The next person will otherwise re-discover it by trial.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.