{"id":84960,"date":"2025-02-13T01:42:53","date_gmt":"2025-02-13T01:42:53","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/build-a-lookup-table-generator-for-google-tag-manager\/"},"modified":"2025-02-13T01:42:53","modified_gmt":"2025-02-13T01:42:53","slug":"build-a-lookup-table-generator-for-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=84960","title":{"rendered":"Build A Lookup Table Generator For Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>In this step-by-step guide, I\u2019ll show you how to build a <strong>Lookup Table generator<\/strong> in <a href=\"https:\/\/sheets.google.com\/\">Google Sheets<\/a>, utilizing <a href=\"https:\/\/developers.google.com\/apps-script\">Apps Script<\/a> and the <a href=\"https:\/\/developers.google.com\/tag-manager\/api\/v2\">Google Tag Manager API<\/a>.<\/p>\n<div style=\"aspect-ratio: 1854 \/ 510;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/lookup-table-generator.jpg\" title=\"Lookup Table Generator\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"510\" width=\"1854\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/lookup-table-generator.jpg#ZgotmplZ\" alt=\"Lookup Table Generator\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>The purpose of the Lookup Table generator is to automate the often tedious task of adding many, many rows to a Lookup Table within the Google Tag Manager UI. There are <a href=\"https:\/\/www.seerinteractive.com\/blog\/gtm-match-table-generator\/\">other<\/a> <a href=\"https:\/\/www.bounteous.com\/insights\/2014\/11\/20\/easy-upload-google-tag-managers-lookup-table-version-2\/\">solutions<\/a> for this, but none (as far as I know) that uses the Google Tag Manager API.<\/p>\n<p>Also, using Google Sheets is a no-brainer, because of the similarities between the Lookup Table variable and a spreadsheet. Both are organized into columns and rows. Google Sheets has a wonderful Apps Script integration, so interacting with the GTM API has been made <em>very<\/em> simple.<\/p>\n<blockquote>\n<p>This tool was inspired by the work I\u2019ve been doing with <a href=\"https:\/\/www.swappie.com\/\">Swappie<\/a>, a company from Finland that refurbishes second-hand smartphones and has a marketplace that makes buying and selling these phones easy and safe. One of their use cases for web analytics is to collect <strong>product margin<\/strong> information into their Ecommerce reports, and this requires a daily updated data sheet where the product SKUs are mapped to their current product margins.<\/p>\n<\/blockquote>\n<p>                <span class=\"simmer\"><br \/>\n  <span class=\"close\">X<\/span><\/p>\n<p>\n    <span class=\"fa fa-md fa-bell\"\/><br \/>\n    <strong>The Simmer Newsletter<\/strong>\n  <\/p>\n<p>\n    Subscribe to the <a href=\"https:\/\/www.simoahava.com\/newsletter\/\">Simmer newsletter<\/a> to get the latest news and content from Simo Ahava into your email inbox!\n  <\/p>\n<p>  <\/span><\/p>\n<h2 id=\"fetch-the-sheet-template\">Fetch the sheet template<\/h2>\n<p>The First thing you\u2019ll want to do is fetch the sheet template. Visit this URL:<\/p>\n<p><a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1LDJ6NOtMMx_5vwRBdPAx9V0gTLnce-7aglQzSm-Ja7M\/\">https:\/\/docs.google.com\/spreadsheets\/d\/1LDJ6NOtMMx_5vwRBdPAx9V0gTLnce-7aglQzSm-Ja7M\/<\/a><\/p>\n<p>Then, click the <strong>File<\/strong> menu and select <strong>Make a copy<\/strong>.<\/p>\n<div style=\"aspect-ratio: 888 \/ 606;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/make-a-copy.jpg\" title=\"Make a copy\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"606\" width=\"888\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/make-a-copy.jpg#ZgotmplZ\" alt=\"Make a copy\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>This makes a copy of the sheet in your drive, and this new sheet is what you\u2019ll be working on.<\/p>\n<h2 id=\"configure-the-sheet\">Configure the sheet<\/h2>\n<p>Next, configure the sheet. For the Lookup Table generator work optimally, you\u2019ll need the following things:<\/p>\n<ol>\n<li>You should create a new Workspace just for the Lookup Table output. That way you don\u2019t have to worry about messing with the Default Workspace (which should rarely, if ever, be used).<\/li>\n<li>You need to create the Lookup Table variable in the Workspace.<\/li>\n<\/ol>\n<p>Once you have these two in place, you need to collect the <strong>Account ID<\/strong>, <strong>Container ID<\/strong>, <strong>Workspace ID<\/strong>, and <strong>Lookup Table variable ID<\/strong>. The easiest way to do that is to browse to <strong>Variables<\/strong> in the GTM UI, and then <em>right-click<\/em> the Lookup Table variable, and copy its link address.<\/p>\n<div style=\"aspect-ratio: 1752 \/ 932;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/copy-link-address.jpg\" title=\"Copy Link Address\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"932\" width=\"1752\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/copy-link-address.jpg#ZgotmplZ\" alt=\"Copy Link Address\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>If you explore that URL, it will look something like this:<\/p>\n<p><code>...\/accounts\/23019854\/containers\/8060344\/workspaces\/1000128\/variables\/730<\/code><\/p>\n<p>The <strong>Account ID<\/strong> is the <em>first<\/em> number in that URL, i.e. <code>23019854<\/code>.<\/p>\n<p>The <strong>Container ID<\/strong> is the <em>second<\/em> number in that URL, i.e. <code>8060344<\/code>.<\/p>\n<p>The <strong>Workspace ID<\/strong> is the <em>third<\/em> number in that URL, i.e. <code>1000128<\/code>.<\/p>\n<p>The <strong>Variable ID<\/strong> is the <em>fourth<\/em> number in that URL, i.e. <code>730<\/code>.<\/p>\n<p>Add these to sheet in their appropriate places. Note! You can also type <code>default<\/code> as the Workspace ID, and it will automatically fetch your Default Workspace, assuming that\u2019s the workspace you want to work in. Again, I recommend against this practice. It\u2019s not how <a href=\"https:\/\/www.simoahava.com\/analytics\/google-tag-manager-workspaces\/\">workspaces should be utilized<\/a>.<\/p>\n<div style=\"aspect-ratio: 1972 \/ 320;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/add-details.jpg\" title=\"Add details\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"320\" width=\"1972\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/add-details.jpg#ZgotmplZ\" alt=\"Add details\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h2 id=\"add-the-apps-script-code\">Add the Apps Script code<\/h2>\n<p>Next, in the Google Sheet, launch the <strong>Script Editor<\/strong>. Click <strong>Tools<\/strong> and then choose <strong>Script Editor<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1004 \/ 402;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/script-editor.jpg\" title=\"Script editor\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"402\" width=\"1004\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/script-editor.jpg#ZgotmplZ\" alt=\"Script editor\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>If this is your first time using the Script Editor, you might need to jump through a few steps, but eventually you should see this:<\/p>\n<div style=\"aspect-ratio: 1124 \/ 580;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/blank-script-editor.jpg\" title=\"Blank script editor\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"580\" width=\"1124\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/blank-script-editor.jpg#ZgotmplZ\" alt=\"Blank script editor\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>The next thing to do is to <em>rename<\/em> the project. Click the <code>Untitled project<\/code> text in the top left corner, and rename the project to e.g. <code>Lookup Table Generator<\/code>. Once you click <strong>OK<\/strong>, the project will be saved, and you can access its details through <a href=\"https:\/\/script.google.com\/\">script.google.com<\/a>.<\/p>\n<p>Now, <strong>delete<\/strong> all the code in the editor, and replace it with the code copy-pasted from <a href=\"https:\/\/gist.github.com\/sahava\/d032099a84c0eeb31709204172e7707c\">this gist<\/a>.<\/p>\n<div style=\"aspect-ratio: 2040 \/ 916;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/gist-lookup.jpg\" title=\"Gist lookup\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"916\" width=\"2040\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/gist-lookup.jpg#ZgotmplZ\" alt=\"Gist lookup\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Remember to click the <strong>Raw<\/strong> button to get the code in plain text format, ready to be copy-pasted into the script editor.<\/p>\n<h3 id=\"code-walkthrough\">Code walkthrough<\/h3>\n<p>I\u2019m not going to step-by-step you through the code, but I\u2019ll briefly introduce what each <em>method<\/em> does.<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>getIds<\/code><\/td>\n<td>Parses the Google Sheet for the IDs (Account ID, Container ID, Workspace ID, Variable ID) the user has added to their appropriate places.<\/td>\n<\/tr>\n<tr>\n<td><code>getDefaultWorkspaceId<\/code><\/td>\n<td>If the user typed <code>default<\/code> as the workspace ID, or if the workspace ID they gave does not exist, the sheet falls back to the \u201cDefault Workspace\u201d. This method fetches its workspace ID.<\/td>\n<\/tr>\n<tr>\n<td><code>getLookupTable<\/code><\/td>\n<td>This method uses the Google Tag Manager API to fetch the Lookup Table variable the Variable ID points to.<\/td>\n<\/tr>\n<tr>\n<td><code>sendData<\/code><\/td>\n<td>The data in the Google Sheet is collected, mapped to its correct API resource format, and sent to Google Tag Manager. The contents in the sheet are used to update (i.e. replace) the Lookup Table variable contents in the GTM container.<\/td>\n<\/tr>\n<tr>\n<td><code>populateSheet<\/code><\/td>\n<td>This method uses the IDs (from <code>getIds<\/code>) to fetch the current contents of the Lookup Table variable into the Google Sheet.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"finalize-apps-script-configuration\">Finalize Apps Script configuration<\/h3>\n<p>In addition to the code, you also need to enable API access in the Script Editor. Click <strong>Resources<\/strong> and select <strong>Advanced Google services..<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1164 \/ 350;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/advanced-google-services.jpg\" title=\"Advanced Google Services\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"350\" width=\"1164\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/advanced-google-services.jpg#ZgotmplZ\" alt=\"Advanced Google Services\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the overlay that opens, scroll down to <code>Tagmanager<\/code>, make sure it has <code>v2<\/code> selected as the version, and then enable it by clicking the toggle at the end.<\/p>\n<div style=\"aspect-ratio: 1392 \/ 840;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/tag-manager-api.jpg\" title=\"Enable GTM API\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"840\" width=\"1392\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/tag-manager-api.jpg#ZgotmplZ\" alt=\"Enable GTM API\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Click <strong>OK<\/strong> when done.<\/p>\n<h3 id=\"test-with-the-data-fetch\">Test with the data fetch<\/h3>\n<p>To quickly test if the code works, select the <code>populateSheet<\/code> function from the appropriate menu in the Script Editor.<\/p>\n<div style=\"aspect-ratio: 1076 \/ 522;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/select-populatesheet.jpg\" title=\"Select populateSheet\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"522\" width=\"1076\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/select-populatesheet.jpg#ZgotmplZ\" alt=\"Select populateSheet\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Then, press the <strong>Play<\/strong> button just to the left of the \u201cBug\u201d icon in the Script Editor toolbar.<\/p>\n<p>The script should now prompt to request authorization. Click <strong>Review Permissions<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1092 \/ 352;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/review-permissions.jpg\" title=\"Review permissions\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"352\" width=\"1092\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/review-permissions.jpg#ZgotmplZ\" alt=\"Review permissions\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Follow the sign-in prompts until you see the \u201cThis app isn\u2019t verified\u201d prompt. This screen means that Google hasn\u2019t <em>verified<\/em> this app yet. It\u2019s using APIs that can be dangerous in the wrong hands, which is why Google warns about this app.<\/p>\n<p>Since we are building this for internal use only, you don\u2019t have to worry about this prompt. You can click the <strong>Advanced<\/strong> link and then the <strong>Go to <em>your project<\/em> (unsafe)<\/strong> link.<\/p>\n<div style=\"aspect-ratio: 1212 \/ 1112;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/security-warning.jpg\" title=\"Safety warning\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1112\" width=\"1212\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/security-warning.jpg#ZgotmplZ\" alt=\"Safety warning\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Finally, click the <strong>Allow<\/strong> button at the bottom of the last screen in the flow.<\/p>\n<div style=\"aspect-ratio: 1158 \/ 652;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/allow-access.jpg\" title=\"Allow access\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"652\" width=\"1158\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/allow-access.jpg#ZgotmplZ\" alt=\"Allow access\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>At this point, the script will run. Once it\u2019s complete, you can step back into your Google Sheet to see it populated with the Lookup Table variable contents.<\/p>\n<div style=\"aspect-ratio: 1050 \/ 494;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/sheet-populated.jpg\" title=\"Sheet populated\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"494\" width=\"1050\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/sheet-populated.jpg#ZgotmplZ\" alt=\"Sheet populated\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h3 id=\"test-with-the-data-update\">Test with the data update<\/h3>\n<p>Let\u2019s try updating the variable with data from the sheet.<\/p>\n<p>Do whatever modifications you want with the sheet content first.<\/p>\n<blockquote>\n<p><strong>Note!<\/strong> Do not touch the <strong>Input<\/strong> and <strong>Output<\/strong> headers. Start modifying the sheet from the row after these.<\/p>\n<\/blockquote>\n<div style=\"aspect-ratio: 1136 \/ 628;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/updates.jpg\" title=\"Rows updated\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"628\" width=\"1136\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/updates.jpg#ZgotmplZ\" alt=\"Rows updated\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, go back to Script Editor, and this time choose <code>sendData<\/code> from the list of functions to run. Click the Play button again.<\/p>\n<div style=\"aspect-ratio: 958 \/ 496;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/run-senddata.jpg\" title=\"Run sendData\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"496\" width=\"958\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/run-senddata.jpg#ZgotmplZ\" alt=\"Run sendData\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>If all works well, you should now be able to see the modified Lookup Table variable in the workspace in the Google Tag Manager UI.<\/p>\n<div style=\"aspect-ratio: 1092 \/ 820;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/modified-lookup-table.jpg\" title=\"Modified lookup table\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"820\" width=\"1092\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/modified-lookup-table.jpg#ZgotmplZ\" alt=\"Modified lookup table\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h3 id=\"map-the-buttons-in-the-sheet\">Map the buttons in the sheet<\/h3>\n<p>Finally, to make the sheet a bit easier to use, let\u2019s map the two buttons in the sheet to their corresponding functions.<\/p>\n<p>Right-click the <strong>Fetch data<\/strong> button, click the little action menu in the top-right corner and choose <strong>Assign script<\/strong>.<\/p>\n<div style=\"aspect-ratio: 764 \/ 432;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/assign-fetch-data.jpg\" title=\"Assign script\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"432\" width=\"764\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/assign-fetch-data.jpg#ZgotmplZ\" alt=\"Assign script\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Type <code>populateSheet<\/code> in the prompt that opens and click OK.<\/p>\n<div style=\"aspect-ratio: 792 \/ 504;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/08\/populate-sheet.jpg\" title=\"populateSheet\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"504\" width=\"792\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/08\/populate-sheet.jpg#ZgotmplZ\" alt=\"populateSheet\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, do the same for the <strong>Update data<\/strong> button, but instead of <code>populateSheet<\/code> type <code>sendData<\/code> into the prompt before clicking OK.<\/p>\n<p>Now, whenever someone clicks the <strong>Fetch data<\/strong> button, the script will populate the sheet with the variable details (assuming the user who clicks the button has authorized access to Google Tag Manager). Whenever someone clicks the <strong>Update data<\/strong> button, the script will update the Lookup Table variable in Google Tag Manager with the contents of the sheet.<\/p>\n<blockquote>\n<p>If you want to edit the button again, you need to <strong>right-click it<\/strong>, as left-clicking it will simply run the script.<\/p>\n<\/blockquote>\n<h2 id=\"summary\">Summary<\/h2>\n<p>I hope this proof-of-concept was easy to follow. With these steps, you can create a Lookup Table Generator for internal use.<\/p>\n<p>There are limitations to how much the script can be run while unverified. You\u2019ll want to take a look at <a href=\"https:\/\/support.google.com\/cloud\/answer\/7454865?hl=en\">this documentation<\/a> to understand what steps need to be taken if you want to get rid of the security warnings.<\/p>\n<p>Basically, if the script is only intended for occasional use by the developer (you), or if the script is meant to be used only by users within your <strong>G Suite organization<\/strong>, you don\u2019t have to verify the app.<\/p>\n<p>For any other type of extended use, the app needs to be <strong>verified<\/strong>, and this is <a href=\"https:\/\/developers.google.com\/apps-script\/guides\/client-verification\">an intricate, often tedious process<\/a>.<\/p>\n<p>Google Sheets + Google Apps Script is one of the most powerful, easily accessible automation flows out there. It requires minimal understanding of the Google Cloud Platform, as almost everything is abstracted in the Apps Script sandbox.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>In this step-by-step guide, I\u2019ll show you how to build a Lookup Table generator in Google Sheets, utilizing Apps Script and the Google Tag Manager API. The purpose of the Lookup Table generator is to automate the often tedious task of adding many, many rows to a Lookup Table within the Google Tag Manager UI. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":84961,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[5293,24377,1531,41975,14495,893,1791],"dealstore":[],"offerexpiration":[],"class_list":["post-84960","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-build","tag-generator","tag-google","tag-lookup","tag-manager","tag-table","tag-tag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Build A Lookup Table Generator For Google Tag Manager - Som2ny Network<\/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:\/\/fivemor.com\/?p=84960\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build A Lookup Table Generator For Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"In this step-by-step guide, I\u2019ll show you how to build a Lookup Table generator in Google Sheets, utilizing Apps Script and the Google Tag Manager API. The purpose of the Lookup Table generator is to automate the often tedious task of adding many, many rows to a Lookup Table within the Google Tag Manager UI. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=84960\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-13T01:42:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1854\" \/>\n\t<meta property=\"og:image:height\" content=\"510\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=84960#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=84960\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Build A Lookup Table Generator For Google Tag Manager\",\"datePublished\":\"2025-02-13T01:42:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=84960\"},\"wordCount\":1437,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=84960#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg\",\"keywords\":[\"Build\",\"Generator\",\"Google\",\"Lookup\",\"Manager\",\"Table\",\"TAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=84960#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=84960\",\"url\":\"https:\/\/fivemor.com\/?p=84960\",\"name\":\"Build A Lookup Table Generator For Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=84960#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=84960#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg\",\"datePublished\":\"2025-02-13T01:42:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=84960#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=84960\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=84960#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg\",\"width\":1854,\"height\":510},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=84960#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build A Lookup Table Generator For Google Tag Manager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Build A Lookup Table Generator For Google Tag Manager - Som2ny Network","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:\/\/fivemor.com\/?p=84960","og_locale":"en_US","og_type":"article","og_title":"Build A Lookup Table Generator For Google Tag Manager - Som2ny Network","og_description":"In this step-by-step guide, I\u2019ll show you how to build a Lookup Table generator in Google Sheets, utilizing Apps Script and the Google Tag Manager API. The purpose of the Lookup Table generator is to automate the often tedious task of adding many, many rows to a Lookup Table within the Google Tag Manager UI. [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=84960","og_site_name":"Som2ny Network","article_published_time":"2025-02-13T01:42:53+00:00","og_image":[{"width":1854,"height":510,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=84960#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=84960"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Build A Lookup Table Generator For Google Tag Manager","datePublished":"2025-02-13T01:42:53+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=84960"},"wordCount":1437,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=84960#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg","keywords":["Build","Generator","Google","Lookup","Manager","Table","TAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=84960#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=84960","url":"https:\/\/fivemor.com\/?p=84960","name":"Build A Lookup Table Generator For Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=84960#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=84960#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg","datePublished":"2025-02-13T01:42:53+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=84960#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=84960"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=84960#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/lookup-table-generator.jpg","width":1854,"height":510},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=84960#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Build A Lookup Table Generator For Google Tag Manager"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/84960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=84960"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/84960\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/84961"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=84960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=84960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=84960"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=84960"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=84960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}