How to create and manage triggers in Google Tag Manager

Author:

Creating and managing triggers in Google Tag Manager (GTM) is essential for determining when tags should fire. Triggers help define conditions for your tags, such as specific user actions or events occurring on your website. Here’s a comprehensive guide on how to create and manage triggers in GTM.

Step-by-Step Guide to Create and Manage Triggers in Google Tag Manager

1. Access Google Tag Manager

  • Log In to GTM: Go to the Google Tag Manager website and log in to your account.
  • Select Your Container: Choose the appropriate container where you want to create or manage triggers.

2. Understanding Triggers

  • What is a Trigger?: A trigger in GTM is a condition that specifies when a tag should be executed. Triggers can be based on various user interactions, such as page views, clicks, form submissions, and more.
  • Common Trigger Types:
    • Page View
    • Click (All Elements or Just Links)
    • Form Submission
    • Timer
    • History Change (for Single Page Applications)
    • Custom Events

3. Creating a New Trigger

To create a trigger in GTM:

  1. Navigate to Triggers:
    • In the left sidebar, click on “Triggers.”
  2. Click on “New”:
    • Click the “New” button to create a new trigger.
  3. Name Your Trigger:
    • Give your trigger a descriptive name that reflects its purpose (e.g., “Button Click – Download PDF”).
  4. Choose Trigger Type:
    • Click on “Trigger Configuration” to select the type of trigger you want to create. You can choose from various options based on the action you want to track.
  5. Configure Your Trigger:
    • Page View Trigger:
      • Select “Page View.”
      • Choose whether the trigger should fire on “All Page Views” or specific page views (e.g., specific URL, pages that match certain patterns).
    • Click Trigger:
      • Select “Click – All Elements” or “Click – Just Links.”
      • Specify the conditions under which the trigger should fire (e.g., click on specific elements, use CSS selectors, etc.).
    • Form Submission Trigger:
      • Select “Form Submission.”
      • Choose whether to fire on “All Forms” or specify conditions for specific forms.
  6. Set Additional Conditions:
    • You can define additional conditions by clicking on “Some Clicks” or “Some Page Views,” allowing you to set up more granular rules.
    • Use variables to set conditions. For example, you might set a condition like “Page URL contains ‘thank-you’” to fire a tag only on thank-you pages.
  7. Save the Trigger:
    • Once you’ve configured the trigger, click “Save.”

4. Preview and Test Your Trigger

Before publishing your changes, it’s crucial to test your trigger:

  1. Click on “Preview”:
    • This opens a new tab where you can interact with your website while the debug mode is active.
  2. Navigate Your Site:
    • Perform the actions that should trigger the tag (e.g., clicking a button, submitting a form).
  3. Check Debug Console:
    • The GTM debug console at the bottom of your screen will show whether your trigger fired correctly. You can see which tags fired and when.
  4. Verify Data in Analytics:
    • If the trigger is associated with a tracking tag (like Google Analytics), check your analytics reports to confirm that data is being collected as expected.

5. Managing Existing Triggers

To manage your existing triggers:

  1. Navigate to Triggers:
    • In the left sidebar, click on “Triggers” to see a list of all your triggers.
  2. Edit a Trigger:
    • Click on the name of the trigger you want to modify.
    • Make your changes, such as adjusting the conditions or changing the trigger type.
    • Click “Save” to update the trigger.
  3. Delete a Trigger:
    • To remove a trigger, click on the trigger name, then click on the three vertical dots in the top right corner and select “Delete.”
  4. Pause a Trigger:
    • Instead of deleting, you can pause a trigger. This can be useful for troubleshooting or temporary changes. To do this, click on the trigger, and then use the “Enable” toggle to disable it.
  5. Organize Triggers:
    • Use descriptive names for your triggers to keep them organized.
    • Consider grouping related triggers by naming conventions (e.g., “Event – [Event Name]”) for easy identification.

6. Using Variables with Triggers

Variables play a crucial role in defining trigger conditions:

  • Built-In Variables: GTM comes with several built-in variables, such as Page URL, Click Classes, and Click ID, which can be used to set conditions.
  • User-Defined Variables: You can create custom variables to capture specific data points needed for your triggers.

To enable built-in variables:

  1. Go to Variables: Click on “Variables” in the left sidebar.
  2. Configure Built-In Variables: Click on “Configure” in the Built-In Variables section and enable the ones you want to use.

Conclusion

Creating and managing triggers in Google Tag Manager is a fundamental aspect of setting up effective tracking on your website. By following these steps, you can define when your tags fire based on user interactions, ensuring that you collect the right data to inform your marketing strategies and improve user experience. Regularly review and test your triggers to ensure they function correctly, especially when making updates to your site or adding new features. This proactive approach will help you maintain a robust tracking setup that accurately reflects user behavior and enhances your analytics capabilities.