How to Create a Custom Tag in Google Tag Manager

Creating custom tags in Google Tag Manager (GTM) can be beneficial for tracking specific events on your website, such as clicks, form submissions, or user interactions with various elements. This guide will walk you through the process of setting up a custom tag using the form shown in the image.


1. Select Theme

Tip: Be sure to select the correct theme to avoid issues with tracking. If you change the theme in the future, you may need to recreate or adjust the tags.

2. Tag Name

Tip: Use a naming convention that includes the action and the element, like "Click - Add to Cart" or "Form Submission - Contact Us," to keep your tags organized.

3. Tag Type

Tip: For tracking clicks on buttons or links, select "Click." For tracking forms, choose "Form Submission." Use the type that best matches your tracking needs.

4. Selector Type

Tip: Use ID if you are tracking a unique element on the page (like a single button). Use Class if you want to track multiple elements with the same styling across the page (e.g., buttons with the same class name).

5. CSS Selector

Tip: Use specific selectors to avoid unintended tracking. If you are unsure of the CSS selector, you can right-click the element on your page, select "Inspect," and identify its class or ID in the HTML.

6. Create Tag

Once you’ve filled out the fields, click the Create Tag button to save your custom tag. After you create the tag, it will be configured in GTM with the parameters you specified in this form. You may need to publish or preview the tag in GTM to verify that it’s working as expected.

Example:

Creating a Tag to Track an "Add to Cart" Button Click Let’s walk through an example of creating a custom tag to track clicks on an "Add to Cart" button.

Additional Tips

  • Testing: Use GTM’s preview mode to test your tags before publishing them to ensure they’re firing as expected.
  • Avoid Overlapping Tags: If you have multiple tags for the same element, ensure they don’t conflict by using unique tag names and selectors.
  • Monitoring: After publishing, monitor the tag’s performance in Google Analytics to verify it’s tracking data correctly.

This process provides a straightforward way to create custom tags, allowing for precise tracking of specific user interactions on your site. With custom tags, you gain more control over your analytics and insights, helping you make data-driven decisions to improve user experience.

arrow_upward