The Google Tag Manager Community Template Gallery allows your organization to create and manage tag and variable templates that natively integrate with Google Tag Manager. Your organization can build a template, publish the template repository to GitHub, and then submit your template to the Community Template Gallery to make it available to users worldwide. The benefits to your organization include:
- Your clients will be able to add and use your templates easily.
- Tag Manager users will be exposed to your organization's brand.
- Your clients will be able to deploy your tags within minutes, not months.
- You can publish updates to your templates and make those updates automatically available to your clients.
The process to submit a new template to the Community Template Gallery involves these main steps:
Build your template
To get started, build your template in Google Tag Manager as a custom template. Make sure your template has been thoroughly tested, that the content of your template follows the Style Guide, and that you have a plan or process in place for how to maintain and update your template should the need to do so arise in the future.
Terms of Service
Every new template submission must agree to the Google Tag Manager Community Template Gallery's Terms of Service. To confirm agreement to the Terms of Service for your template:
- Read the Google Tag Manager Community Template Gallery Terms of Service.
- In the Template Editor, open your template for editing and check the box under the Info tab labeled "Agree to the Community Template Gallery Terms of Service".
Export your template
Once your template is complete, export the template file to your local machine and rename the file template.tpl
.
Prepare your project files
The next step is to prepare your repository for publishing on GitHub. Each repository should contain the following files:
- An exported template file named
template.tpl
. This file must be updated to add acategories
entry. - A
metadata.yaml
file. - A
LICENSE
file. Filename must be in ALL CAPS and the contents of the license file must be only Apache 2.0. - Add a
README.md
file (optional, but recommended).
Add categories to template.tpl
Update your template.tpl
file with a categories
entry to the INFO
section, and provide at least one relevant category value selected from the following table. If more than one category is appropriate, you can provide up to three category values, ordered from most relevant to least relevant.
Example:
___INFO___
{
"displayName": "Example Template",
"categories": ["AFFILIATE_MARKETING", "ADVERTISING"],
// additional template properties, etc...
}
Table of supported category values:
Category | Description |
---|---|
ADVERTISING | Advertising |
AFFILIATE_MARKETING | Affiliate marketing |
ANALYTICS | Analytics |
ATTRIBUTION | Attribution |
CHAT | Chat |
CONVERSIONS | Conversion measurement |
DATA_WAREHOUSING | Data Warehousing |
EMAIL_MARKETING | Email Marketing |
EXPERIMENTATION | A/B experiments and content optimization |
HEAT_MAP | Heat maps |
LEAD_GENERATION | Lead generation |
MARKETING | Marketing |
PERSONALIZATION | Personalization |
REMARKETING | Remarketing |
SALES | Sales and CRM |
SESSION_RECORDING | Session recordings |
SOCIAL | Social |
SURVEY | Surveys |
TAG_MANAGEMENT | Tag management systems |
UTILITY | Google Tag Manager utilities |
metadata.yaml
The metadata.yaml
file contains information about your template, including links to your organization's homepage, template documentation, and version information. Each version is denoted by a change number, also known as a SHA number, which is the change number associated with the Git commit. The changeNotes
field is optional, but recommended, to inform your users of the changes included in the version.
To set up your metadata.yaml
file:
- Add an entry
homepage
. This should be a URL that points to your organization's home page. - Add an entry for
documentation
. This should be a URL that points to documentation for your template. - In GitHub, find the commit that includes the changes that you want to push for your initial version of your template and copy the SHA number. An easy way to get the SHA number in GitHub is to go to a commit view and click the clipboard icon (). This will copy the entire SHA number to your clipboard. Paste that number as the value for your
sha
entry as a child of theversions
node, as shown below. - Add a
changeNotes
entry to theversions
node, to briefly describe changes contained in this new version.
homepage: "https://www.example.com"
documentation: "https://www.example.com/documentation"
versions:
- sha: 5f02a788b90ae804f86b04aa24af8937e567874a
changeNotes: Initial release.
Upload to GitHub
The next step is to upload your files to GitHub. Create a GitHub repo with the appropriate files and structure as outlined above.
Template repositories must have the files * template.tpl
, metadata.yaml
, and LICENSE
found at the root level of the Git repository. Each Git repository should only have one template.tpl
file. All resources must be on the main branch in your GitHub repository. Any template repository that does not match this structure will be removed from the Gallery.
Each entry in the Community Template Gallery will link to the Issues section of the template's GitHub repository so that users can let you know if they find a bug. Make sure that issues have not been disabled for your template's GitHub repository so that you can review and address any issues that arise.
Submit your template
Once your template repository is hosted on GitHub, you can proceed to submit your template to the Community Template Gallery. To submit your template, follow these steps:
- Make sure you are signed in to GitHub with an account that has access to the template repository you wish to add to the Gallery.
- Go to the Community Template Gallery at tagmanager.google.com/gallery.
- Click more_vert and select Submit Template.
- Provide the Repository URL in the field provided and click Submit.
Update your template
After you have published a template, you may wish to provide updates to your template from time to time. Your template users will be notified if there is an update to the template and will have the option to update the template to the latest version.
The metadata.yaml
file is used to determine which version of your template to use in the gallery. To publish new versions, you need to add the change number (SHA number) to the versions
section of your metadata.yaml
file.
- Locate the commit that includes the changes that you want to push, and copy the SHA number. An easy way to do this is in GitHub is to go to a commit view and click the clipboard icon (). This will copy the entire SHA number to your clipboard.
- Add a new
sha
entry to the top of yourversions
list inmetadata.yaml
. (See the example below.) - Add
changeNotes
to briefly describe changes contained in this new version. You can create multiline comments, if desired. (See the example below.) - Commit the change to
metadata.yaml
and your update will appear in the gallery typically within 2 to 3 days.
This example demonstrates how to add new version information including the SHA number and change notes:
homepage: "https://www.example.com"
documentation: "https://www.example.com/documentation"
versions:
# Latest version
- sha: 5f02a788b90ae804f86b04aa24af8937e567874c
changeNotes: |2
Fix bug with the whatsamajig.
Improve menu options.
Update API calls.
# Older versions
- sha: 5f02a788b90ae804f86b04aa24af8937e567874b
changeNotes: Adds eject button.
- sha: 5f02a788b90ae804f86b04aa24af8937e567874a
changeNotes: Initial release.