{"id":2563,"date":"2018-08-22T09:10:21","date_gmt":"2018-08-22T09:10:21","guid":{"rendered":"http:\/\/www.rebelytics.com\/?p=713"},"modified":"2025-10-03T13:37:44","modified_gmt":"2025-10-03T13:37:44","slug":"lookup-tables-google-tag-manager","status":"publish","type":"post","link":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/","title":{"rendered":"Cool stuff with lookup tables in Google Tag Manager"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2563\" class=\"elementor elementor-2563\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2ef37db6 e-flex e-con-boxed e-con e-parent\" data-id=\"2ef37db6\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;ekit_has_onepagescroll_dot&quot;:&quot;yes&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-6046a20b elementor-widget elementor-widget-text-editor\" data-id=\"6046a20b\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p><strong>Lookup tables are one of the most useful and powerful features of Google Tag Manager when it comes to customising and improving your Google Analytics tracking configuration.<\/strong><\/p><p><em>Note: This article was first published on rebelytics.com in 2015 and has since then been updated several times and moved to this blog.<\/em><\/p><p>In this article, you will find answers to the following questions:<\/p><ul><li>What are GTM lookup tables?<\/li><li>How can I <strong>track my traffic sources correctly<\/strong> with the help of GTM lookup tables?<\/li><li>How can I <strong>track clicks on social icons<\/strong> with GTM lookup tables?<\/li><li>How can I <strong>reduce the number of tags<\/strong> I need using GTM lookup tables?<\/li><\/ul><blockquote><p><em>If you have any additional questions or if anything remains unclear, please don&#8217;t hesitate to leave a comment at the <a href=\"#comments\">bottom of this page<\/a>. I normally reply within a couple of days.<\/em><\/p><\/blockquote><p>So, let&#8217;s get started and have a look at some of the cool stuff you can do with lookup tables in Google Tag Manager.<\/p><h2>What are lookup tables?<\/h2><p>A lookup table in Google Tag Manager is a variable that has the value of another variable as input. Variables, according to <a title=\"Google's definition of variables in GTM V2\" href=\"https:\/\/support.google.com\/tagmanager\/answer\/6106899\" target=\"_blank\" rel=\"noopener noreferrer\">Google&#8217;s definition<\/a>, are <em>&#8220;name-value pairs for which the value is populated during runtime&#8221;<\/em>.<\/p><p>Google Tag Manager has a number of built-in variables, such as &#8220;Page URL&#8221;, &#8220;Page Path&#8221;, or &#8220;Page Hostname&#8221;. The output value of the variable &#8220;Page URL&#8221; is the URL of the current page, so on this page it would be:<\/p><p><em>&#8220;https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/&#8221;<\/em><\/p><p>The value of the variable &#8220;Page Hostname&#8221; is the hostname of the current page, so for this page it would be <em>&#8220;staging.searchviu.com&#8221;<\/em>. The variable &#8220;Page Path&#8221; is the part of the &#8220;Page URL&#8221; that comes after the &#8220;Page Hostname&#8221;, so on this page it would be <em>&#8220;\/en\/lookup-tables-google-tag-manager\/&#8221;<\/em>.<\/p><p>You can check the output values of all the active variables on your own website by activating the GTM preview mode and going to &#8220;Variables&#8221;. For the current page, the values of the variables mentioned above are shown like this:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2783\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/dc63b13f-variables-in-gtm-preview-mode.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>On top of the built-in variables, Tag Manager allows you to define your own set of variables. Lookup tables are a type of user-defined variables and they can be very helpful when you use them in triggers (formerly known as rules), but also when you use them in tags to populate certain fields with dynamic values. Later on in this article, we will have a look at some of the possibilities lookup tables give you.<\/p><p>As mentioned above, lookup tables are a type of variable that have the output value of another variable as input. To get back to our &#8220;Page URL&#8221; example, I could use the output of this variable as input for a new lookup table variable that I define myself. Remember that the output of the &#8220;Page URL&#8221; variable always is the URL of the current page. In a lookup table, you always define pairs of values: If the input equals <em>&#8220;xyz&#8221;<\/em>, I want the output to be <em>&#8220;123&#8221;<\/em>. If the input equals <em>&#8220;abc&#8221;<\/em>, I want the output to be <em>&#8220;789&#8221;<\/em>, and so on.<\/p><p>If, for some reason, I wanted to track, let&#8217;s say, the mood I was in when I published my blog articles, I could use a lookup table to define a mood value output for every URL input and send the values to Google Analytics in a custom dimension.<\/p><p><em>This is obviously not a very realistic example for using lookup tables, but don&#8217;t worry, we will also look at some real-world examples in a bit.<\/em><\/p><p>So if the output of the variable &#8220;Page URL&#8221; was <em>&#8220;https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/&#8221;<\/em>, I could use a lookup table that defines the value <em>&#8220;grumpy&#8221;<\/em> for this page view and send it to Google Analytics.<\/p><p>Here&#8217;s what this lookup table would look like in GTM:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2787\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/86861367-lookup-table-page-url-to-mood.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>I could now use the output value of this lookup table to populate a custom dimension in a Google Analytics page view tag. But let&#8217;s just have a look at some real-life examples of lookup tables that actually make sense!<\/p><h2>Use a lookup table to track different traffic sources<\/h2><p>The first time I came in contact with lookup tables was after reading <a title=\"The death of UTM parameters\" href=\"http:\/\/www.lunametrics.com\/blog\/2014\/09\/09\/death-utm-campaign-parameters\/\" target=\"_blank\" rel=\"noopener noreferrer\">this brilliant article on the LunaMetrics blog<\/a>. Jim Gianoglio describes how you can use URL fragments to track different traffic sources in Google Analytics using a lookup table. I love this solution and I have been using it in a slightly modified way on all of my clients&#8217; websites and also here on staging.searchviu.com ever since.<\/p><p>I will quickly walk you through setting this up in Google Tag Manager (V2). The goal of this solution is to be able to track the traffic your social posts and other traffic sources generate without having to use Google&#8217;s UTM tracking parameters (the horrible ones that look like this and don&#8217;t even fit in a line on this blog:<br \/><em>&#8220;?utm_source=facebook.com&amp;utm_medium=social&amp;utm_campaign=facebook-posts&#8221;<\/em>).<\/p><p>First, you need to set up a user defined variable of the type &#8220;URL&#8221;. In the configuration of the variable, select the component type <em>&#8220;Fragment&#8221;<\/em>. Make sure you give the variable a clear name that you will remember and recognise, like <em>&#8220;URL fragment&#8221;<\/em>. This variable will now have the URL fragment of the current page as output. Here&#8217;s what it looks like in GTM:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-1105\" src=\"https:\/\/www.rebelytics.com\/wp-content\/uploads\/2016\/04\/URL-fragment-variable-in-GTM.jpg\" alt=\"URL-fragment-variable-in-GTM\" \/><\/p><p>A URL fragment is the part of the URL that comes after the hash (#), if there is one. So now your Tag Manager configuration is able to read the URL fragments of URLs like this:<\/p><ul><li>https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#twitter<\/li><li>https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#facebook<\/li><li>https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#linkedin<\/li><li>and so on<\/li><\/ul><p>Do you see where this is heading? You can now tag the links you share on social media or in your newsletter in a much easier and more user-friendly way than with UTM tracking parameters. Next, let&#8217;s see how to get this data into Google Analytics.<\/p><p>So why don&#8217;t we just send the value of the &#8220;URL fragment&#8221; variable straight to Google Analytics? Because URL fragments are used for plenty of purposes and we only want to send the values we defined for our different marketing channels to Google Analytics. This is where the lookup table comes in handy: It acts as a kind of filter. Also, wouldn&#8217;t it be nice to populate the dimensions &#8220;source, &#8220;medium&#8221; and &#8220;campaign&#8221;, just like we do with UTM parameters?<\/p><p>Let me walk you through this step by step. First, we need three lookup tables, one for each of the dimensions &#8220;source&#8221;, &#8220;campaign&#8221; and &#8220;medium&#8221;. The input values are the same in all of them (the URL fragments we use for tracking our traffic sources), and the output values are the values we want to show up in the three dimensions &#8220;source&#8221;, &#8220;medium&#8221; and &#8220;campaign&#8221; for each of the input values.<\/p><p>Here&#8217;s what the lookup table for the dimension &#8220;source&#8221; would look like if we wanted to track the traffic sources for the three example URLs above:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2793\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/17ace156-source-lookup-table.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>The lookup table for the dimension &#8220;medium&#8221; looks very similar, with the only difference that the output values are changed:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2794\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/9bba470d-medium-lookup-table.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>And finally, the lookup table for the medium &#8220;campaign&#8221;, you get it!<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2795\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/a26aac83-campaign-lookup-table.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>Now, if I visit the URL <em>&#8220;https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#twitter&#8221;<\/em>, which I would use for sharing this article on Twitter, I see the following values for my new variables in the GTM preview mode:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2797\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/5359bc59-lookup-table-values-gtm-preview.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>Next, let&#8217;s have a look at the last step that is needed in order to get this data into Google Analytics. All you need to do is to go to your Google Analytics page views tag in Google Tag Manager (or to your Google Analytics settings variable, if you&#8217;re using one), and add the output values of your new lookup tables to the fields &#8220;campaignSource&#8221;, &#8220;campaignMedium&#8221; and &#8220;campaignName&#8221; in the section &#8220;Fields to set&#8221;, as you can see in this screenshot:<\/p><p><img decoding=\"async\" class=\"alignnone size-full wp-image-2798\" src=\"https:\/\/storage.googleapis.com\/seoviu_wordpress\/blog\/2018\/08\/f73e6651-fields-to-set-ga-tag-gtm.jpeg\" alt=\"\" width=\"100%\" \/><\/p><p>The URL fragments <em>&#8220;#twitter&#8221;<\/em>, <em>&#8220;#facebook&#8221;<\/em> and <em>&#8220;#linkedin&#8221;<\/em> now have the same function as the following UTM parameter chains:<\/p><ul><li>?utm_source=twitter.com&amp;utm_medium=social&amp;utm_campaign=tweets<\/li><li>?utm_source=facebook.com&amp;utm_medium=social&amp;utm_campaign=facebook-posts<\/li><li>?utm_source=linkedin.com&amp;utm_medium=social&amp;utm_campaign=linkedin-posts<\/li><\/ul><p>Pretty awesome, isn&#8217;t it? Shoutouts to Jim Gianoglio for inspiring this method with the Luna Metrics article I linked to above, and to my former colleague and wizard web analyst <a href=\"https:\/\/www.linkedin.com\/in\/sascha-schau-5804a810a\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sascha Schau<\/a>, who helped me refine this method when we were working together.<\/p><p>Let&#8217;s have a look at some more cool stuff you can do with lookup tables in Google Tag Manager.<\/p><h2>Use a lookup table to track clicks on social icons<\/h2><p>Another very interesting way to use lookup tables is for the tracking of outbound links. For the social profiles that you link to from your website, you can create a lookup table that defines a descriptive output value for each of the URLs you link to, for example <em>&#8220;facebook profile&#8221;<\/em>, <em>&#8220;google+ profile&#8221;<\/em>, and so on.<\/p><p>You can now use the output of this lookup table as a condition in a link click trigger and at the same time to populate the values of the events you send to Google Analytics. Here are the steps you need to undertake:<\/p><ul><li style=\"list-style-type: none;\"><ul><li>Create a lookup table that gives a descriptive name to the URLs of the outbound links you want to track. Use the URLs of your social profiles as inputs and the descriptive names as outputs.<\/li><\/ul><\/li><\/ul><p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-1107\" src=\"https:\/\/www.rebelytics.com\/wp-content\/uploads\/2016\/04\/lookup-table-for-social-profile-URLs.jpg\" alt=\"lookup-table-for-social-profile-URLs\" width=\"1885\" height=\"1216\" \/><\/p><ul><li style=\"list-style-type: none;\"><ul><li>Create a new trigger with the event type <em>&#8220;click&#8221;<\/em>.<\/li><li>Choose the type <em>&#8220;link click&#8221;<\/em>.<\/li><li>Select <em>&#8220;Fire on some clicks&#8221;<\/em>, select the name of your new lookup table, and set the condition that it match a regular expression with all the output values of your lookup table, separated by vertical bars, for example: <em>googleplus|linkedin|twitter<\/em><\/li><\/ul><\/li><\/ul><p><img decoding=\"async\" class=\"alignnone size-full wp-image-1108\" src=\"https:\/\/www.rebelytics.com\/wp-content\/uploads\/2016\/04\/social-profile-click-trigger-GTM.jpg\" alt=\"social-profile-click-trigger-GTM\" \/><\/p><ul><li style=\"list-style-type: none;\"><ul><li>Create a new Universal Analytics Tag and select the track type <em>&#8220;event&#8221;<\/em>.<\/li><li>Use your new lookup table to populate the fields you send to Google Analytics. It makes sense to use the output value in the field <em>&#8220;Label&#8221;<\/em> under <em>&#8220;Event tracking parameters&#8221;<\/em>.<\/li><\/ul><\/li><\/ul><p><img decoding=\"async\" class=\"alignnone size-full wp-image-1109\" src=\"https:\/\/www.rebelytics.com\/wp-content\/uploads\/2016\/04\/Profile-click-event-tag-settings.jpg\" alt=\"Profile-click-event-tag-settings\" \/><\/p><ul><li style=\"list-style-type: none;\"><ul><li>In the last step of your Google Analytics tag configuration, select <em>&#8220;fire on click&#8221;<\/em> and pick your newly created link click trigger.<\/li><\/ul><\/li><\/ul><p><img decoding=\"async\" class=\"alignnone size-full wp-image-1110\" src=\"https:\/\/www.rebelytics.com\/wp-content\/uploads\/2016\/04\/Fire-GTM-tag-on-click-event.jpg\" alt=\"Fire-GTM-tag-on-click-event\" \/><\/p><p>This is so easy that it feels like cheating! But we&#8217;re already done. Your outbound link clicks are now being tracked in Google Analytics and the data even looks nice because you used a lookup table to set descriptive names.<\/p><h2>Use lookup tables to reduce the number of tags you need<\/h2><p>If you tried to set up the solution described above without lookup tables, you would probably succeed, but you would need a hell of a lot of tags. So lookup tables help you reduce the number of tags in this case and they do so in many other cases.<\/p><p>You might be using a Google Tag Manager container for several domains. Think about using a lookup table that defines an Analytics tracking ID output for a hostname input. This way you could use one Google Analytics tag to track data in several properties.<\/p><p>Also, with the right combination of lookup tables, you will not need different tags of the same track type any more. One pageview tag, one event tag, one transaction tag (and so on), will be enough in many cases. This makes your Tag Manager account look a lot tidier and it leaves less room for stupid mistakes.<\/p><p>Once you start working with lookup tables you will realise how much time they save you and also how much fun it is to quickly set up things that would have taken an hour before.<\/p><p>If you have any questions or thoughts about this article, please don&#8217;t hesitate to drop me a comment!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-2c5d3c6 e-flex e-con-boxed e-con e-parent\" data-id=\"2c5d3c6\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;ekit_has_onepagescroll_dot&quot;:&quot;yes&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e47e3f0 elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"e47e3f0\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"divider.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-74d0411 e-flex e-con-boxed e-con e-parent\" data-id=\"74d0411\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;ekit_has_onepagescroll_dot&quot;:&quot;yes&quot;}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t<div class=\"elementor-element elementor-element-4528a72 e-con-full e-flex e-con e-child\" data-id=\"4528a72\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;,&quot;ekit_has_onepagescroll_dot&quot;:&quot;yes&quot;}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-a354bf2 elementor-widget elementor-widget-elementskit-heading\" data-id=\"a354bf2\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"elementskit-heading.default\">\n\t\t\t\t\t<div class=\"ekit-wid-con\" ><div class=\"ekit-heading elementskit-section-title-wraper text_left   ekit_heading_tablet-   ekit_heading_mobile-\"><h2 class=\"ekit-heading--title elementskit-section-title \">Summary of 33 Comments<\/h2><div class=\"ekit_heading_separetor_wraper ekit_heading_elementskit-border-divider elementskit-style-long\"><div class=\"elementskit-border-divider elementskit-style-long\"><\/div><\/div><h3 class=\"ekit-heading--subtitle elementskit-section-subtitle  \">\n\t\t\t\t\t\tComment Highlights &amp; Key Takeaways\n\t\t\t\t\t<\/h3><\/div><\/div>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7422752 elementor-widget elementor-widget-text-editor\" data-id=\"7422752\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p class=\"MuiTypography-root MuiTypography-body1 css-1n3cajb\">Here&#8217;s a handy overview of the most valuable questions, fixes, and lessons shared by the community in the comments below. If you&#8217;re diving into Google Tag Manager (GTM) lookup tables, UTM tracking, or advanced tracking tricks, don&#8217;t skip this summary!<\/p><hr class=\"MuiDivider-root MuiDivider-fullWidth css-ss6lby\" \/><h5><br \/>1. <strong>Setting Up UTM Tracking with URL Fragments<\/strong><\/h5><ul><li>Readers were keen on using simple URL fragments (like<div><code>\/#1<\/code><\/div><p>) to pass source, medium, and campaign info to Google Analytics without exposing messy UTMs in links.<\/p><\/li><li><strong>Best Practice:<\/strong><br \/><em>&#8220;You will need three lookup tables to set this up, one for the dimension &#8216;source&#8217;, one for &#8216;medium&#8217;, and one for &#8216;campaign&#8217;. Use the URL fragment as input for each table.&#8221;<\/em><br \/>\u2014 <em>Eoghan, Author<\/em><\/li><li>Trying to cram all parameters into one lookup table is a common pitfall\u2014one table per dimension is the way to go.<\/li><\/ul><h5><br \/>2. <strong>Debugging &amp; Troubleshooting<\/strong><\/h5><ul><li>Many users struggled when real-time GA reports didn\u2019t reflect expected UTM sources.<ul><li><strong>Possible Causes:<\/strong> Real-time reporting quirks, missing parameters (like<div><code>campaignMedium<\/code><\/div><p>), or partial lookups.<\/p><\/li><li><strong>Tip:<\/strong> Check GTM\u2019s \u201cFields to set\u201d in preview mode, and verify normal reports after a few hours if real-time seems off.<\/li><li><em>&#8220;GA might have problems if campaignSource is sent without campaignMedium because those two dimensions are tightly linked.&#8221;<\/em><br \/>\u2014 <em>Eoghan<\/em><\/li><\/ul><\/li><\/ul><h5><br \/>3. <strong>Handling Special Cases<\/strong><\/h5><ul><li><strong>iframes:<\/strong> The approach works\u2014even inside iframes\u2014as long as GTM is properly embedded, and cross-domain tracking is used for different domains.<\/li><li><strong>PDF Links:<\/strong><ul><li>Fragments in PDF URLs (&#8216;#&#8217;) won\u2019t be tracked unless you implement server-side solutions, since GTM can\u2019t run inside PDFs.<\/li><li><em>&#8220;You need to set up server-side tracking or something like LunaMetrics&#8217; solution&#8230;&#8221;<\/em><br \/>\u2014 <em>Eoghan<\/em><\/li><\/ul><\/li><li><strong>Multiple Fragments:<\/strong><ul><li>URLs support only a single fragment, so using two fragments (e.g.<div><code>#tw#wintercampaign<\/code><\/div><p>) isn\u2019t possible.<\/p><\/li><\/ul><\/li><\/ul><h5><br \/>4. <strong>Lookup Table Limits &amp; Advanced Usage<\/strong><\/h5><ul><li><strong>One-to-Many Matching:<\/strong> Lookup tables in GTM initially only supported \u201cequals\u201d matching (no wildcards or regex).<ul><li>Users with complex needs (e.g., \u201c1,4,7 = Mastercard\u201d) had to enter a row for each value.<\/li><li><strong>Recent Update:<\/strong><ul><li><em>&#8220;Currently GTM allows regex matching for strings and lookup tables, which is great.&#8221;<\/em><br \/>\u2014 <em>User<\/em><\/li><li><em>Eoghan<\/em> acknowledged this as a new feature\u2014look out for updates!<\/li><\/ul><\/li><\/ul><\/li><li><strong>Pattern Matching:<\/strong> For tasks like extracting product IDs from URLs, custom JavaScript variables or regex-based workarounds (see Simo Ahava&#8217;s guides) are required.<ul><li><em>&#8220;Lookup tables support only exact matches&#8230;You can use a custom JavaScript variable to extract part of the URL and feed that to a lookup table.&#8221;<\/em><\/li><\/ul><\/li><\/ul><h5><br \/>5. <strong>Bulk Management &amp; Workflow<\/strong><\/h5><ul><li>Users wanted easier ways to import many lookup table rows.<ul><li><em>Eoghan<\/em> pointed to community tools like Seer Interactive\u2019s Match Table Generator and noted LunaMetrics\u2019 fixes.<\/li><\/ul><\/li><\/ul><h5><br \/>6. <strong>Multi-Domain &amp; Ad Tagging<\/strong><\/h5><ul><li>Adopting lookup tables for multi-domain sites (serving different GA or Google Ads IDs) is a useful, scalable pattern.<ul><li>Separate tables per ID\/label, keyed by the hostname, is recommended.<\/li><\/ul><\/li><\/ul><h5><br \/>7. <strong>Processing Canonical URLs<\/strong><\/h5><ul><li>If your canonical URLs include the full domain but you only want the path (e.g.,<div><code>\/dog\/food<\/code><\/div><p>), you\u2019ll need a Custom JS variable in GTM to extract and send just the part you want.<\/p><\/li><\/ul><hr class=\"MuiDivider-root MuiDivider-fullWidth css-ss6lby\" \/><h4><br \/>Notable Highlights<\/h4><ul><li><strong>Community Spirit:<\/strong> The comment section is filled with supportive, practical advice from Eoghan and helpful follow-up questions from readers.<\/li><li><strong>Evolving Platform:<\/strong> GTM keeps improving (e.g. regex support), so it&#8217;s worth checking for updates and new community tools.<\/li><li><strong>Real-world Scenarios:<\/strong> Lots of users encountered edge cases\u2014iframes, complicated URLs, wanting content- or ad-specific tracking\u2014so don&#8217;t be afraid to ask specifics.<\/li><\/ul><hr class=\"MuiDivider-root MuiDivider-fullWidth css-ss6lby\" \/><h4><br \/>Summary<\/h4><p class=\"MuiTypography-root MuiTypography-body1 css-1n3cajb\"><strong>The main takeaways?<\/strong><\/p><ul><li>For UTM tracking via URL fragments, use dedicated lookup tables for each dimension\u2014don\u2019t shortcut with one table.<\/li><li>Double-check all parameters and reference fields in GTM, especially campaignMedium.<\/li><li>GTM lookup tables have some core limitations (and cool workarounds via JavaScript), but Google continues to add features like regex matching.<\/li><li>For complex mapping, multi-domain setups, or pattern-matching tasks, expect to use creative custom variables or external tools.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Lookup tables are one of the most useful and powerful features of Google Tag Manager when it comes to customising your Google Analytics tracking configuration. Learn what lookup tables are and how you can use them to improve your website tracking.<\/p>\n","protected":false},"author":3,"featured_media":1089,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[9],"tags":[29],"class_list":["post-2563","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-analytics","tag-engllish"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GTM lookup table: How to use Google Tag Manager lookup tables<\/title>\n<meta name=\"description\" content=\"Read this article to learn what lookup tables in Google Tag Manager are and how to improve your Google Analytics tracking with their help.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GTM lookup table: How to use Google Tag Manager lookup tables\" \/>\n<meta property=\"og:description\" content=\"Read this article to learn what lookup tables in Google Tag Manager are and how to improve your Google Analytics tracking with their help.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/\" \/>\n<meta property=\"og:site_name\" content=\"SEO Data Warehouse And Monitoring\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-22T09:10:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-03T13:37:44+00:00\" \/>\n<meta name=\"author\" content=\"Eoghan Henn\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@searchviu\" \/>\n<meta name=\"twitter:site\" content=\"@searchviu\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eoghan Henn\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/\"},\"author\":{\"name\":\"Eoghan Henn\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#\\\/schema\\\/person\\\/7a031e5565b9ece3fd77be3c7f19381c\"},\"headline\":\"Cool stuff with lookup tables in Google Tag Manager\",\"datePublished\":\"2018-08-22T09:10:21+00:00\",\"dateModified\":\"2025-10-03T13:37:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/\"},\"wordCount\":2615,\"commentCount\":33,\"publisher\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.searchviu.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg\",\"keywords\":[\"Engllish\"],\"articleSection\":[\"Web Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/\",\"url\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/\",\"name\":\"GTM lookup table: How to use Google Tag Manager lookup tables\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.searchviu.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg\",\"datePublished\":\"2018-08-22T09:10:21+00:00\",\"dateModified\":\"2025-10-03T13:37:44+00:00\",\"description\":\"Read this article to learn what lookup tables in Google Tag Manager are and how to improve your Google Analytics tracking with their help.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.searchviu.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.searchviu.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg\",\"width\":400,\"height\":269},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/lookup-tables-google-tag-manager\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cool stuff with lookup tables in Google Tag Manager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#website\",\"url\":\"https:\\\/\\\/www.searchviu.com\\\/\",\"name\":\"SEO Data Warehouse And Monitoring\",\"description\":\"SEO Solutions For Teams And Agencies\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.searchviu.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#organization\",\"name\":\"searchVIU\",\"url\":\"https:\\\/\\\/www.searchviu.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.searchviu.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/d3babe41-searchviu-logo2x.png\",\"contentUrl\":\"https:\\\/\\\/www.searchviu.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/d3babe41-searchviu-logo2x.png\",\"width\":340,\"height\":340,\"caption\":\"searchVIU\"},\"image\":{\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/searchviu\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/searchviu\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.searchviu.com\\\/#\\\/schema\\\/person\\\/7a031e5565b9ece3fd77be3c7f19381c\",\"name\":\"Eoghan Henn\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/88ecd619af8b41640851bdb169ff87f2ddec10119431686bd36effdde5ff2eb8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/88ecd619af8b41640851bdb169ff87f2ddec10119431686bd36effdde5ff2eb8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/88ecd619af8b41640851bdb169ff87f2ddec10119431686bd36effdde5ff2eb8?s=96&d=mm&r=g\",\"caption\":\"Eoghan Henn\"},\"url\":\"https:\\\/\\\/www.searchviu.com\\\/en\\\/author\\\/eoghan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GTM lookup table: How to use Google Tag Manager lookup tables","description":"Read this article to learn what lookup tables in Google Tag Manager are and how to improve your Google Analytics tracking with their help.","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:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/","og_locale":"en_US","og_type":"article","og_title":"GTM lookup table: How to use Google Tag Manager lookup tables","og_description":"Read this article to learn what lookup tables in Google Tag Manager are and how to improve your Google Analytics tracking with their help.","og_url":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/","og_site_name":"SEO Data Warehouse And Monitoring","article_published_time":"2018-08-22T09:10:21+00:00","article_modified_time":"2025-10-03T13:37:44+00:00","author":"Eoghan Henn","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg","twitter_creator":"@searchviu","twitter_site":"@searchviu","twitter_misc":{"Written by":"Eoghan Henn","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#article","isPartOf":{"@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/"},"author":{"name":"Eoghan Henn","@id":"https:\/\/www.searchviu.com\/#\/schema\/person\/7a031e5565b9ece3fd77be3c7f19381c"},"headline":"Cool stuff with lookup tables in Google Tag Manager","datePublished":"2018-08-22T09:10:21+00:00","dateModified":"2025-10-03T13:37:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/"},"wordCount":2615,"commentCount":33,"publisher":{"@id":"https:\/\/www.searchviu.com\/#organization"},"image":{"@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#primaryimage"},"thumbnailUrl":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg","keywords":["Engllish"],"articleSection":["Web Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/","url":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/","name":"GTM lookup table: How to use Google Tag Manager lookup tables","isPartOf":{"@id":"https:\/\/www.searchviu.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#primaryimage"},"image":{"@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#primaryimage"},"thumbnailUrl":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg","datePublished":"2018-08-22T09:10:21+00:00","dateModified":"2025-10-03T13:37:44+00:00","description":"Read this article to learn what lookup tables in Google Tag Manager are and how to improve your Google Analytics tracking with their help.","breadcrumb":{"@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#primaryimage","url":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg","contentUrl":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/2325f192-lookup-tables-google-tag-manager-400x269-1.jpg","width":400,"height":269},{"@type":"BreadcrumbList","@id":"https:\/\/www.searchviu.com\/en\/lookup-tables-google-tag-manager\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.searchviu.com\/en\/"},{"@type":"ListItem","position":2,"name":"Cool stuff with lookup tables in Google Tag Manager"}]},{"@type":"WebSite","@id":"https:\/\/www.searchviu.com\/#website","url":"https:\/\/www.searchviu.com\/","name":"SEO Data Warehouse And Monitoring","description":"SEO Solutions For Teams And Agencies","publisher":{"@id":"https:\/\/www.searchviu.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.searchviu.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.searchviu.com\/#organization","name":"searchVIU","url":"https:\/\/www.searchviu.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.searchviu.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/d3babe41-searchviu-logo2x.png","contentUrl":"https:\/\/www.searchviu.com\/wp-content\/uploads\/2023\/02\/d3babe41-searchviu-logo2x.png","width":340,"height":340,"caption":"searchVIU"},"image":{"@id":"https:\/\/www.searchviu.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/searchviu","https:\/\/www.linkedin.com\/company\/searchviu\/"]},{"@type":"Person","@id":"https:\/\/www.searchviu.com\/#\/schema\/person\/7a031e5565b9ece3fd77be3c7f19381c","name":"Eoghan Henn","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/88ecd619af8b41640851bdb169ff87f2ddec10119431686bd36effdde5ff2eb8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/88ecd619af8b41640851bdb169ff87f2ddec10119431686bd36effdde5ff2eb8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/88ecd619af8b41640851bdb169ff87f2ddec10119431686bd36effdde5ff2eb8?s=96&d=mm&r=g","caption":"Eoghan Henn"},"url":"https:\/\/www.searchviu.com\/en\/author\/eoghan\/"}]}},"modified_by":null,"_links":{"self":[{"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/posts\/2563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/comments?post=2563"}],"version-history":[{"count":10,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/posts\/2563\/revisions"}],"predecessor-version":[{"id":8016,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/posts\/2563\/revisions\/8016"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/media\/1089"}],"wp:attachment":[{"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/media?parent=2563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/categories?post=2563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.searchviu.com\/en\/wp-json\/wp\/v2\/tags?post=2563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}