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](https://developers.google.com/tag-platform/tag-manager/templates/gallery#update_your_template) 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:

1. [Build your template](https://developers.google.com/tag-platform/tag-manager/templates/gallery#build_your_template)
2. [Prepare your project files](https://developers.google.com/tag-platform/tag-manager/templates/gallery#prepare_your_project_files)
3. [Upload your files to GitHub](https://developers.google.com/tag-platform/tag-manager/templates/gallery#upload_to_github)
4. [Submit your template](https://developers.google.com/tag-platform/tag-manager/templates/gallery#submit_your_template)

## Build your template

To get started, build your template in Google Tag Manager as a [custom template](https://developers.google.com/tag-platform/tag-manager/templates). Make sure your template has been thoroughly tested, that the content of your template follows the [Style Guide](https://developers.google.com/tag-platform/tag-manager/templates/style), 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:

1. Read the [Google Tag Manager Community Template Gallery Terms of Service](https://developers.google.com/tag-platform/tag-manager/templates/gallery-tos).
2. 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](https://developers.google.com/tag-platform/tag-manager/templates#export_and_import) 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:

1. An [exported template file](https://developers.google.com/tag-platform/tag-manager/templates#export_and_import) named **`template.tpl`** . This file must be updated to add a [`categories`](https://developers.google.com/tag-platform/tag-manager/templates/gallery#add_categories_to_templatetpl) entry.
2. A **[`metadata.yaml`](https://developers.google.com/tag-platform/tag-manager/templates/gallery#metadatayaml)** file.
3. A **`LICENSE`** file. Filename must be in ALL CAPS and the contents of the license file must be *only* [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
4. Add a **`README.md`** file (optional, but recommended).

> [!NOTE]
> **Note:** Use the [sample template repository](https://github.com/gtm-vendor-templates/example-community-template) on GitHub as a model. Copy the `LICENSE` file from the sample template to your project to be absolutely sure there are no errors in the content, and be sure update the Copyright line where it says "`Copyright [yyyy] [name of copyright owner]`" in the sample version. Replace `yyyy` with the year of copyright and `[name of copyright owner]` with the copyright owner's name.

### 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.

> [!NOTE]
> **Note:** Values for the `categories` entry should be formatted as an array.

**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:

1. Add an entry `homepage`. This should be a URL that points to your organization's home page.
2. Add an entry for `documentation`. This should be a URL that points to documentation for your template.
3. 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](https://help.github.com/en/articles/differences-between-commit-views) and click the clipboard icon (![clipboard icon](https://developers.google.com/static/tag-platform/tag-manager/templates/img/githubclipboard.png "GitHub's 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 the `versions` node, as shown below.
4. Add a `changeNotes` entry to the `versions` 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.

> [!IMPORTANT]
> **Important:** `sha` and `changeNotes` must be aligned as shown in the above code example.

> [!NOTE]
> **Note:** The `sha` value must reference the specific template.tpl file that you want to publish. Don't forget to update this value correctly with every new [version](https://developers.google.com/tag-platform/tag-manager/templates/gallery#update_your_template)!

## 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](https://developers.google.com/tag-platform/tag-manager/templates/gallery#prepare_your_project_files).

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](https://help.github.com/en/articles/creating-an-issue)** section of the template's GitHub repository so that users can let you know if they find a bug.

> [!IMPORTANT]
> **Important:** Make sure that **Issues** have not been disabled for your template's GitHub repository and that email notifications are enabled so that you can be notified of any issues that arise during template review.

## 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:

1. 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.
2. Go to the Community Template Gallery at [tagmanager.google.com/gallery](https://tagmanager.google.com/gallery).
3. Click and select **Submit Template**.
4. 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](https://support.google.com/tagmanager/answer/9454109#update).

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.

1. 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](https://help.github.com/en/articles/differences-between-commit-views) and click the clipboard icon (![clipboard icon](https://developers.google.com/static/tag-platform/tag-manager/templates/img/githubclipboard.png "GitHub's clipboard icon")). This will copy the entire SHA number to your clipboard.
2. Add a new `sha` entry to the top of your `versions` list in `metadata.yaml`. (See the example below.)
3. Add `changeNotes` to briefly describe changes contained in this new version. You can create multiline comments, if desired. (See the example below.)
4. 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.

> [!IMPORTANT]
> **Important:** Every published version of the template should be included in the `versions` section ordered in **reverse chronological order**, (most recent to oldest).

> [!NOTE]
> **Note:** Not every incremental commit needs to be included as a version change to the Community Templates Gallery. For example, if you make incremental changes in commits 1, 2, and 3, and the final version is commit 4, you should have just one entry for commit 4 that includes all changes from commits 1, 2, and 3.

## Move your repository

If you want to change owners or repository names you can use the [GitHub
repository transfer process](https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository).
The new location will be detected and users will automatically be forwarded to
the new repository the next time they update the template.

## Remove your template

To remove a template from the gallery, delete either the `LICENSE` file or the
`metadata.yaml` file from its repository. The gallery monitoring system will
detect this change and automatically remove the template.