{"id":51152874,"url":"https://github.com/mailchimp/mailchimp-gtm-pixel","last_synced_at":"2026-06-26T07:31:08.827Z","repository":{"id":367197019,"uuid":"1258588514","full_name":"mailchimp/mailchimp-gtm-pixel","owner":"mailchimp","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-25T00:40:15.000Z","size":145,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-25T02:07:49.536Z","etag":null,"topics":["2600846378130028576","gtm","intuit","mailchimp","pixels"],"latest_commit_sha":null,"homepage":"","language":"Smarty","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mailchimp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T18:14:30.000Z","updated_at":"2026-06-23T19:19:15.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mailchimp/mailchimp-gtm-pixel","commit_stats":null,"previous_names":["mailchimp/mailchimp-gtm-pixel"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mailchimp/mailchimp-gtm-pixel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fmailchimp-gtm-pixel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fmailchimp-gtm-pixel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fmailchimp-gtm-pixel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fmailchimp-gtm-pixel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailchimp","download_url":"https://codeload.github.com/mailchimp/mailchimp-gtm-pixel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailchimp%2Fmailchimp-gtm-pixel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34808043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2600846378130028576","gtm","intuit","mailchimp","pixels"],"created_at":"2026-06-26T07:31:08.306Z","updated_at":"2026-06-26T07:31:08.814Z","avatar_url":"https://github.com/mailchimp.png","language":"Smarty","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mailchimp-gtm-pixel\n\nA Google Tag Manager (GTM) **custom tag template** that loads the Mailchimp\nSite Tracking pixel and translates standard GA4 ecommerce `dataLayer` events\ninto Mailchimp's tracking schema.\n\nThis repository is structured for submission to the\n[GTM Community Template Gallery](https://developers.google.com/tag-platform/tag-manager/templates/gallery).\n\nThe template:\n\n- Loads `https://chimpstatic.com/mcjs-connected/bridge/v1/gtm-bridge.js`\n  (a tiny shim that exposes `window.mcTrack` and `window.mcIdentify`).\n- Maps GA4 ecommerce events → Mailchimp events:\n  - `view_item` → `PRODUCT_VIEWED`\n  - `add_to_cart` → `PRODUCT_ADDED_TO_CART`\n  - `begin_checkout` → `CHECKOUT_STARTED`\n  - `purchase` → `PURCHASED`\n- Optionally sends identifiers to Mailchimp:\n  - GA `_ga` client id as `GOOGLE_CLIENT_ID`\n  - SHA-256 of the normalized email as `EMAIL_SHA256`\n  - SHA-256 of the E.164-normalized phone as `PHONE_SHA256`\n\n## Repository layout\n\nThe Gallery requires these three files at the repo root, on `main`:\n\n```\ntemplate.tpl       # GTM Custom Template (TAG, WEB) — exported from the editor\nmetadata.yaml      # Gallery metadata: homepage, documentation, versions\nLICENSE            # Apache 2.0 (required by the Gallery)\nREADME.md          # This file\n```\n\n## Installing in GTM (manual import)\n\n1. In your GTM container, go to **Templates → Tag Templates → New**.\n2. In the template editor, choose **⋮ → Import**.\n3. Select `template.tpl` from this repo.\n4. Save the template.\n5. Create a new tag using the template and fill in:\n   - **Mailchimp User ID** (`mcUserId`)\n   - **Mailchimp Connected Site ID** (`mcConnectedSiteId`)\n   - Toggle the identifier checkboxes you want enabled.\n6. Add triggers:\n   - An **Initialization — All Pages** trigger (warms up the bridge on\n     `gtm.js` / `gtm.dom` / `gtm.load`).\n   - A custom event trigger for each ecommerce event you want to forward\n     (`view_item`, `add_to_cart`, `begin_checkout`, `purchase`).\n\n## Required dataLayer shape\n\nThe template reads three keys from the dataLayer: `event`, `ecommerce`, and\n(optionally) `user_data`. Standard GA4 ecommerce events work as-is, for\nexample:\n\n```js\nwindow.dataLayer = window.dataLayer || [];\ndataLayer.push({ ecommerce: null });\ndataLayer.push({\n  event: 'purchase',\n  ecommerce: {\n    transaction_id: 'tx-123',\n    value: 59.98,\n    tax: 4.50,\n    shipping: 5.00,\n    currency: 'USD',\n    items: [\n      { item_id: 'sku-1', item_name: 'Hat', price: 29.99, quantity: 2 }\n    ]\n  },\n  user_data: {\n    email: 'shopper@example.com',\n    phone_number: '+1 (555) 123-4567'\n  }\n});\n```\n\n## GTM Permissions used\n\n| Permission       | Scope                                                                 |\n| ---------------- | --------------------------------------------------------------------- |\n| `logging`        | Debug environment only                                                |\n| `access_globals` | `mcTrack` (r/w/x), `mcIdentify` (r/w/x), `__mcGtmConfig` (r/w)        |\n| `get_cookies`    | `_ga`                                                                 |\n| `read_data_layer`| `event`, `ecommerce`, `user_data`                                     |\n| `inject_script`  | `https://chimpstatic.com/mcjs-connected/bridge/v1/gtm-bridge.js`      |\n\n## Categories\n\nThe Gallery `INFO` block declares the following categories (most → least\nrelevant):\n\n1. `ANALYTICS`\n2. `EMAIL_MARKETING`\n3. `MARKETING`\n\n## Development\n\nThe `.tpl` file is GTM's custom-template format with sections delimited by\n`___SECTION___` markers. To iterate:\n\n1. Open `template.tpl` in GTM's template editor (or any editor — it's plain\n   text).\n2. Edit the `___SANDBOXED_JS_FOR_WEB_TEMPLATE___` block for runtime\n   behavior.\n3. Edit `___TEMPLATE_PARAMETERS___` for the tag UI.\n4. Edit `___WEB_PERMISSIONS___` when adding new APIs (each new `require(...)`\n   typically needs a matching permission).\n5. Add/adjust scenarios under `___TESTS___`. They run inside GTM's template\n   sandbox via **Run tests** in the template editor.\n\n## Tests\n\n`___TESTS___` covers:\n\n- Bridge URL constant\n- `_ga` cookie → GA client id parsing\n- Email lowercasing/trimming\n- Phone E.164 digit-stripping\n- GA4 → Mailchimp event-name mapping (including unknown events)\n- Cart-id fallback\n- Line-item mapping, including missing-price → `0` (no `NaN`)\n- ID validation\n- Full payload shape for `PRODUCT_VIEWED`, `PRODUCT_ADDED_TO_CART`,\n  `CHECKOUT_STARTED`, `PURCHASED` (with and without tax/shipping)\n- Init-event recognition (`gtm.js` / `gtm.dom` / `gtm.load`)\n- `__mcGtmConfig` merge preserves pre-existing keys\n\nRun them from inside the GTM template editor via **Run tests**.\n\n## Submitting / updating the Gallery entry\n\nThe Gallery key is `metadata.yaml`. Every published version is listed under\n`versions:` (newest first) with the SHA of the commit that contains the\nfinal `template.tpl` for that version.\n\nTo publish an update:\n\n1. Land your `template.tpl` changes on `main`.\n2. Copy the commit SHA of that landing commit.\n3. Prepend a new entry to the top of `versions:` in `metadata.yaml`:\n   ```yaml\n   versions:\n     - sha: \u003cnew-commit-sha\u003e\n       changeNotes: |2\n         Short summary of what changed.\n     # …older versions follow…\n   ```\n4. Commit and push. The Gallery picks up the change within a few days.\n\n## Customer testing\n\nFor a step-by-step guide to testing this template with a customer (extracting\nthe User ID / Connected Site ID from the existing pixel snippet, importing\nthe template, smoke-testing in GTM Preview, and verifying events in\nMailchimp), see [`docs/CUSTOMER_TESTING.md`](./docs/CUSTOMER_TESTING.md).\n\n## License\n\nApache License 2.0 — see [`LICENSE`](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailchimp%2Fmailchimp-gtm-pixel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailchimp%2Fmailchimp-gtm-pixel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailchimp%2Fmailchimp-gtm-pixel/lists"}