Skip to main content

How to Trigger a Tag in Google Tag Manager Based on a Specific URL Path

Step by Step guide to identify website visitors for a specific page on your website

Leadsourcing Team avatar
Written by Leadsourcing Team
Updated over 2 weeks ago

Trigger a tag in Google Tag Manager (GTM) to identify your web visitor only when they visit a specific website path / page for more accurate analytics or campaigns.

Requirements

❕ You need:

  • Editor or Admin access to your Google Tag Manager container.

  • Your website has GTM installed and working.

  • The exact URL path or pattern you want to monitor.

  • Know if your path is always the same, or if you'd prefer a RegEx match.

If you’re unsure about your access, contact your website admin to confirm your GTM permissions.

Step 1: Create a New Trigger

  • Open your GTM workspace.

  • Click “Triggers” in the left menu.

  • Click “New” and enter a clear name (e.g., “Trigger on /products/ visits”).

New Trigger

Step 2: Choose Trigger Type

  • Click “Trigger Configuration.”

  • Select the “Page View” type.

Step 3: Configure the URL Path Condition

  • Under “This trigger fires on,” pick “Some Page Views.”

  • Set a condition:

    • Choose “Page Path” as the variable.

    • Select the match type:

      • “contains” for a simple match (e.g., /products/)

      • “equals” for an exact path (e.g., /products/)

      • “matches RegEx” for advanced patterns (e.g., ^/products/)

    • Enter your specific path or pattern.

Use “Page URL” if your condition needs the entire address (including domain and protocol).

Step 4: Save the Trigger

  • Click “Save.”

  • Review your new trigger—make sure the name and conditions are clear.

Step 5: Associate the Trigger with a Tag

  • Go to “Tags.”

  • Select or create the tag you want to fire.

  • In the “Triggering” section, add your new trigger.

Step 6: Test and Publish

  • Click “Preview” and enter your website’s URL to use GTM’s preview/debug mode.

  • Visit the target path to verify the trigger works (the tag should fire as expected).

  • Return to GTM and click “Submit” to publish your container when verified.

Verification & Next Steps

  • Visit the target path on your site with GTM preview/debug enabled.

  • Check the “Tags Fired” section for your tag.

  • If needed, adjust trigger conditions and retest before publishing.

Tips & Best Practices

  • Use descriptive names for triggers and tags to make future changes easier.

  • For complex URL patterns, confirm your RegEx using an online tool before adding to GTM.

  • Always test in preview mode before publishing to avoid data errors.

If you need further assistance or your tag isn’t firing as expected, contact support for expert troubleshooting. Setting targeted triggers ensures your AI-powered lead generation remains precise and actionable.

Did this answer your question?