{"id":10719,"date":"2024-11-20T20:07:54","date_gmt":"2024-11-20T20:07:54","guid":{"rendered":"https:\/\/ceowebltd.com\/blog\/?p=10719"},"modified":"2024-11-20T20:07:54","modified_gmt":"2024-11-20T20:07:54","slug":"how-to-use-regex-for-advanced-url-matching-in-google-tag-manager","status":"publish","type":"post","link":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/","title":{"rendered":"How to use regex for advanced URL matching in Google Tag Manager"},"content":{"rendered":"<p>Using regular expressions (regex) in Google Tag Manager (GTM) for advanced URL matching allows you to create more flexible and precise triggers and variables. Regex is particularly useful for matching patterns in URLs that are dynamic or follow a specific structure. By utilizing regex, you can create triggers that fire only on specific types of pages or interactions, even when the URL includes variables, query parameters, or dynamic elements.<\/p>\n<p>In this guide, we\u2019ll walk through how to use regex for advanced URL matching in GTM.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#What_is_Regex\" title=\"What is Regex?\">What is Regex?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Step_1_Basic_Setup_in_Google_Tag_Manager\" title=\"Step 1: Basic Setup in Google Tag Manager\">Step 1: Basic Setup in Google Tag Manager<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Step_2_Create_or_Edit_a_Trigger_Using_Regex\" title=\"Step 2: Create or Edit a Trigger Using Regex\">Step 2: Create or Edit a Trigger Using Regex<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Example_1_Match_Exact_URLs\" title=\"Example 1: Match Exact URLs\">Example 1: Match Exact URLs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Example_2_Match_Multiple_Pages_with_a_Common_Structure\" title=\"Example 2: Match Multiple Pages with a Common Structure\">Example 2: Match Multiple Pages with a Common Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Example_3_Match_URLs_with_Query_Parameters\" title=\"Example 3: Match URLs with Query Parameters\">Example 3: Match URLs with Query Parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Example_4_Match_URLs_with_Optional_Query_Parameters\" title=\"Example 4: Match URLs with Optional Query Parameters\">Example 4: Match URLs with Optional Query Parameters<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Step_3_Using_Regex_in_GTM_Triggers\" title=\"Step 3: Using Regex in GTM Triggers\">Step 3: Using Regex in GTM Triggers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Step_4_Create_a_Tag_to_Fire_Based_on_Your_Trigger\" title=\"Step 4: Create a Tag to Fire Based on Your Trigger\">Step 4: Create a Tag to Fire Based on Your Trigger<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Step_5_Testing_Your_Regex_Setup\" title=\"Step 5: Testing Your Regex Setup\">Step 5: Testing Your Regex Setup<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Step_6_Advanced_Regex_Examples\" title=\"Step 6: Advanced Regex Examples\">Step 6: Advanced Regex Examples<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Example_1_Match_URL_with_Multiple_Parameters\" title=\"Example 1: Match URL with Multiple Parameters\">Example 1: Match URL with Multiple Parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Example_2_Match_URLs_with_a_Specific_File_Extension\" title=\"Example 2: Match URLs with a Specific File Extension\">Example 2: Match URLs with a Specific File Extension<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"What_is_Regex\"><\/span>What is Regex?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Regular expressions (regex) are a sequence of characters that form a search pattern. In GTM, regex can be used to match strings (like URLs or page paths) that meet specific patterns or conditions. It is a powerful tool that can be used to match complex URLs that contain dynamic or variable elements, such as query parameters, subdomains, or page numbers.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Step_1_Basic_Setup_in_Google_Tag_Manager\"><\/span>Step 1: Basic Setup in Google Tag Manager<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before you use regex for URL matching, ensure you have GTM set up on your website.<\/p>\n<ol>\n<li><strong>Sign up and create an account<\/strong>: If you haven&#8217;t already, sign up for GTM and create a container for your website.<\/li>\n<li><strong>Install GTM<\/strong>: Once you create the container, Google Tag Manager will provide two snippets of code. These should be added to your website to enable tracking and use of GTM.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Step_2_Create_or_Edit_a_Trigger_Using_Regex\"><\/span>Step 2: Create or Edit a Trigger Using Regex<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol>\n<li><strong>Access Google Tag Manager<\/strong>: Log into your GTM account and open the container associated with your website.<\/li>\n<li><strong>Create a New Trigger<\/strong>: On the left panel, click on <strong>Triggers<\/strong> and then click <strong>New<\/strong> to create a new trigger. Alternatively, you can edit an existing trigger that uses URL matching.<\/li>\n<li><strong>Choose Trigger Type<\/strong>: Choose <strong>Page View<\/strong> (for tracking page loads) or any other trigger type that fits your needs, such as <strong>Click<\/strong> for tracking button clicks.<\/li>\n<li><strong>Set up URL Matching with Regex<\/strong>:\n<ul>\n<li><strong>Page URL Variable<\/strong>: In GTM, the variable used for URL matching is typically the <strong>Page URL<\/strong> variable, which is automatically available in GTM.<\/li>\n<li>To use regex, you\u2019ll need to choose <strong>Some Page Views<\/strong> under the trigger configuration. Then, choose the <strong>Page URL<\/strong> variable and set the condition to match using regex.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4><span class=\"ez-toc-section\" id=\"Example_1_Match_Exact_URLs\"><\/span>Example 1: Match Exact URLs<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>For URLs that match a specific pattern, you can use a simple regex like this:<\/p>\n<ul>\n<li><strong>Regex<\/strong>: <code>^\/about-us$<\/code><\/li>\n<li><strong>Explanation<\/strong>: This matches exactly the <code>\/about-us<\/code> path and will not match any other variations or additional query parameters.<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Example_2_Match_Multiple_Pages_with_a_Common_Structure\"><\/span>Example 2: Match Multiple Pages with a Common Structure<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>If you want to match URLs that contain a certain structure but have different dynamic elements (e.g., product pages or categories), you can use regex like:<\/p>\n<ul>\n<li><strong>Regex<\/strong>: <code>^\/products\/[a-zA-Z0-9_-]+$<\/code><\/li>\n<li><strong>Explanation<\/strong>: This matches any URL that starts with <code>\/products\/<\/code> followed by alphanumeric characters, underscores, or hyphens. For example, <code>\/products\/shoes<\/code>, <code>\/products\/smartphone-123<\/code>, etc.<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Example_3_Match_URLs_with_Query_Parameters\"><\/span>Example 3: Match URLs with Query Parameters<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>If you want to match URLs that contain specific query parameters, regex is useful for capturing these patterns. For example, to match any URL that contains the parameter <code>utm_campaign<\/code>:<\/p>\n<ul>\n<li><strong>Regex<\/strong>: <code>\\?utm_campaign=.*<\/code><\/li>\n<li><strong>Explanation<\/strong>: This matches any URL that has <code>?utm_campaign=<\/code> followed by any sequence of characters (i.e., any value for the <code>utm_campaign<\/code> parameter).<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Example_4_Match_URLs_with_Optional_Query_Parameters\"><\/span>Example 4: Match URLs with Optional Query Parameters<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>You can also use regex to match URLs with optional query parameters. For instance, if you want to match all URLs that either have or don\u2019t have a <code>ref<\/code> parameter:<\/p>\n<ul>\n<li><strong>Regex<\/strong>: <code>^\/landing-page(\\?ref=[a-zA-Z0-9_-]+)?$<\/code><\/li>\n<li><strong>Explanation<\/strong>: This matches the <code>\/landing-page<\/code> path with or without the <code>ref<\/code> parameter. The <code>(\\?ref=[a-zA-Z0-9_-]+)?<\/code> portion makes the <code>ref<\/code> parameter optional.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Step_3_Using_Regex_in_GTM_Triggers\"><\/span>Step 3: Using Regex in GTM Triggers<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To apply regex in your triggers, follow these steps:<\/p>\n<ol>\n<li><strong>Open the Trigger Configuration<\/strong>: If you&#8217;re creating a new trigger, after selecting the trigger type (e.g., <strong>Page View<\/strong> or <strong>Click<\/strong>), click on the <strong>Choose a variable<\/strong> dropdown.<\/li>\n<li><strong>Select &#8220;Page URL&#8221;<\/strong>: For page-related triggers, select <strong>Page URL<\/strong> as the variable. For click-related triggers, you can use <strong>Click URL<\/strong> or other click-related variables depending on your needs.<\/li>\n<li><strong>Select &#8220;Matches Regex&#8221;<\/strong>: From the condition dropdown, select <strong>Matches Regex<\/strong>. This tells GTM that you are using a regular expression for pattern matching.<\/li>\n<li><strong>Enter Your Regex Pattern<\/strong>: In the text field, enter your regular expression (for example, the patterns shown in the examples above).<\/li>\n<li><strong>Save the Trigger<\/strong>: Once your regex is set up, click <strong>Save<\/strong>.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Step_4_Create_a_Tag_to_Fire_Based_on_Your_Trigger\"><\/span>Step 4: Create a Tag to Fire Based on Your Trigger<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>After setting up the trigger, you can create a tag that fires when the trigger condition is met.<\/p>\n<ol>\n<li><strong>Create a New Tag<\/strong>: In the left sidebar, click <strong>Tags<\/strong> and then <strong>New<\/strong>.<\/li>\n<li><strong>Choose Tag Type<\/strong>: Select a tag type, such as <strong>Google Analytics<\/strong> or <strong>Custom HTML<\/strong> depending on your needs.<\/li>\n<li><strong>Configure Tag<\/strong>: Set up your tag, specifying details like event category, action, or any other necessary information (for example, track page views in Google Analytics).<\/li>\n<li><strong>Set Trigger for Tag<\/strong>: Under the <strong>Triggering<\/strong> section, select the trigger you created using regex.<\/li>\n<li><strong>Save and Publish<\/strong>: Once you\u2019re satisfied with the configuration, click <strong>Save<\/strong> and <strong>Publish<\/strong> to apply the changes.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Step_5_Testing_Your_Regex_Setup\"><\/span>Step 5: Testing Your Regex Setup<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Before your tag is live, it\u2019s important to test if everything works correctly.<\/p>\n<ol>\n<li><strong>Preview Mode<\/strong>: Click <strong>Preview<\/strong> in GTM to enter debug mode. Enter the URL of your website and verify that the trigger fires as expected when visiting URLs that match your regex.<\/li>\n<li><strong>Use GTM Debug Panel<\/strong>: Once in preview mode, you can interact with the website. In the GTM debug panel at the bottom of the screen, you\u2019ll see a list of tags that have fired based on the triggers you\u2019ve set up.<\/li>\n<li><strong>Use Google Analytics Real-Time Reports<\/strong>: If you&#8217;re using Google Analytics, you can also monitor the <strong>Real-Time<\/strong> events to see if your tag is firing when expected.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Step_6_Advanced_Regex_Examples\"><\/span>Step 6: Advanced Regex Examples<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Here are some advanced regex patterns you can use in Google Tag Manager:<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Example_1_Match_URL_with_Multiple_Parameters\"><\/span>Example 1: Match URL with Multiple Parameters<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>If you want to match URLs with multiple query parameters, such as <code>utm_source<\/code> and <code>utm_medium<\/code>:<\/p>\n<ul>\n<li><strong>Regex<\/strong>: <code>\\?utm_source=[a-zA-Z0-9_-]+&amp;utm_medium=[a-zA-Z0-9_-]+<\/code><\/li>\n<li><strong>Explanation<\/strong>: This will match URLs like <code>\/page?utm_source=google&amp;utm_medium=cpc<\/code>.<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Example_2_Match_URLs_with_a_Specific_File_Extension\"><\/span>Example 2: Match URLs with a Specific File Extension<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>To match URLs ending in <code>.pdf<\/code> or <code>.jpg<\/code>:<\/p>\n<ul>\n<li><strong>Regex<\/strong>: <code>\\.(pdf|jpg)$<\/code><\/li>\n<li><strong>Explanation<\/strong>: This will match any URL that ends with <code>.pdf<\/code> or <code>.jpg<\/code>.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Regex in Google Tag Manager provides powerful capabilities for tracking and managing events based on complex URL patterns. Whether you&#8217;re trying to match a specific page path, query parameters, or a combination of dynamic URL elements, regex can help you capture those interactions with precision. By understanding and applying regex correctly, you can create highly customized triggers that enhance your tracking and analytics setup in GTM.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using regular expressions (regex) in Google Tag Manager (GTM) for advanced URL matching allows you to create more flexible and precise triggers and variables. Regex&#8230;<\/p>\n","protected":false},"author":214,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-10719","post","type-post","status-publish","format-standard","hentry","category-digital-marketing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use regex for advanced URL matching in Google Tag Manager - CEOweb Ltd. Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use regex for advanced URL matching in Google Tag Manager - CEOweb Ltd. Blog\" \/>\n<meta property=\"og:description\" content=\"Using regular expressions (regex) in Google Tag Manager (GTM) for advanced URL matching allows you to create more flexible and precise triggers and variables. Regex...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/\" \/>\n<meta property=\"og:site_name\" content=\"CEOweb Ltd. Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-20T20:07:54+00:00\" \/>\n<meta name=\"author\" content=\"Emmanuel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Emmanuel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/\",\"url\":\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/\",\"name\":\"How to use regex for advanced URL matching in Google Tag Manager - CEOweb Ltd. Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ceowebltd.com\/blog\/#website\"},\"datePublished\":\"2024-11-20T20:07:54+00:00\",\"dateModified\":\"2024-11-20T20:07:54+00:00\",\"author\":{\"@id\":\"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/4759c204c0b0f1d134ec16e8ec777a6f\"},\"breadcrumb\":{\"@id\":\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ceowebltd.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use regex for advanced URL matching in Google Tag Manager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ceowebltd.com\/blog\/#website\",\"url\":\"https:\/\/ceowebltd.com\/blog\/\",\"name\":\"CEOweb Ltd. Blog\",\"description\":\"Guest Posting - Digital Marketing &amp; Web Services\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ceowebltd.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/4759c204c0b0f1d134ec16e8ec777a6f\",\"name\":\"Emmanuel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9e883d40261b9b272de51992551b3eec4df631b7579a4fbec69c36a006dcbaf2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9e883d40261b9b272de51992551b3eec4df631b7579a4fbec69c36a006dcbaf2?s=96&d=mm&r=g\",\"caption\":\"Emmanuel\"},\"url\":\"https:\/\/ceowebltd.com\/blog\/author\/emmanuel\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use regex for advanced URL matching in Google Tag Manager - CEOweb Ltd. Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/","og_locale":"en_US","og_type":"article","og_title":"How to use regex for advanced URL matching in Google Tag Manager - CEOweb Ltd. Blog","og_description":"Using regular expressions (regex) in Google Tag Manager (GTM) for advanced URL matching allows you to create more flexible and precise triggers and variables. Regex...","og_url":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/","og_site_name":"CEOweb Ltd. Blog","article_published_time":"2024-11-20T20:07:54+00:00","author":"Emmanuel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Emmanuel","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/","url":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/","name":"How to use regex for advanced URL matching in Google Tag Manager - CEOweb Ltd. Blog","isPartOf":{"@id":"https:\/\/ceowebltd.com\/blog\/#website"},"datePublished":"2024-11-20T20:07:54+00:00","dateModified":"2024-11-20T20:07:54+00:00","author":{"@id":"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/4759c204c0b0f1d134ec16e8ec777a6f"},"breadcrumb":{"@id":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ceowebltd.com\/blog\/how-to-use-regex-for-advanced-url-matching-in-google-tag-manager\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ceowebltd.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to use regex for advanced URL matching in Google Tag Manager"}]},{"@type":"WebSite","@id":"https:\/\/ceowebltd.com\/blog\/#website","url":"https:\/\/ceowebltd.com\/blog\/","name":"CEOweb Ltd. Blog","description":"Guest Posting - Digital Marketing &amp; Web Services","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ceowebltd.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/4759c204c0b0f1d134ec16e8ec777a6f","name":"Emmanuel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9e883d40261b9b272de51992551b3eec4df631b7579a4fbec69c36a006dcbaf2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9e883d40261b9b272de51992551b3eec4df631b7579a4fbec69c36a006dcbaf2?s=96&d=mm&r=g","caption":"Emmanuel"},"url":"https:\/\/ceowebltd.com\/blog\/author\/emmanuel\/"}]}},"_links":{"self":[{"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/posts\/10719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/users\/214"}],"replies":[{"embeddable":true,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/comments?post=10719"}],"version-history":[{"count":1,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/posts\/10719\/revisions"}],"predecessor-version":[{"id":10720,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/posts\/10719\/revisions\/10720"}],"wp:attachment":[{"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/media?parent=10719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/categories?post=10719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/tags?post=10719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}