templates_import_from_gallery
Import a community template from the GTM Gallery by GitHub owner/repo to use third-party pixels as official sandboxed tags instead of Custom HTML.
Instructions
[WRITE] Install a Community Template Gallery template into a workspace by GitHub owner and repository, so a THIRD-PARTY pixel can use its official sandboxed template instead of Custom HTML. NOT for Google's own tags. GA4, Google Ads and Floodlight are BUILT IN to GTM as native tag types (googtag, gaawe, awct, sp, flc), there is no gallery repository for them, and asking for one answers "404 Not found or permission denied". To build a GA4 event tag call tags_create with type "gaawe" directly; do not import anything first. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. The GTM API DOES support this (templates.import_from_gallery); never tell the user it is UI-only. Idempotent: importing one already present returns it unchanged rather than creating a duplicate. Returns the installed template. To build a tag on it you need its tag TYPE (a cvt_... string): READ that from the container rather than constructing it from the templateId, because the format is not what it appears to be. Pass the exact string as type to tags_create along with that template's own field keys (template-specific, e.g. Meta Pixel uses pixelId). Common pairs: facebook/GoogleTagManager-WebTemplate-For-FacebookPixel (Meta Pixel), tiktok/gtm-template-pixel (TikTok), linkedin/linkedin-gtm-community-template (LinkedIn Insight Tag 2.0), Snapchat/snapchat-google-tag-manager (Snap Pixel), pinterest/ws-gtm-template (Pinterest, web) or pinterest/ss-gtm-template (Pinterest, server), stape-io/facebook-tag and stape-io/tiktok-tag (Stape server-side).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sha | No | Optional gallery version SHA. Defaults to the latest published version. | |
| owner | Yes | GitHub owner of the gallery template, e.g. "linkedin". | |
| confirm | Yes | Must be true to confirm this write operation. | |
| accountId | Yes | The GTM account ID. | |
| repository | Yes | GitHub repository, e.g. "linkedin-gtm-community-template". | |
| containerId | Yes | The GTM container ID. | |
| workspaceId | Yes | The GTM workspace ID. |