{"id":10085,"date":"2024-10-18T12:48:13","date_gmt":"2024-10-18T12:48:13","guid":{"rendered":"https:\/\/ceowebltd.com\/blog\/?p=10085"},"modified":"2024-10-18T12:48:13","modified_gmt":"2024-10-18T12:48:13","slug":"how-to-set-up-and-use-data-layer-variables-in-google-tag-manager","status":"publish","type":"post","link":"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/","title":{"rendered":"How to set up and use data layer variables in Google Tag Manager"},"content":{"rendered":"<p>Setting up and using <strong>Data Layer Variables<\/strong> in <strong>Google Tag Manager (GTM)<\/strong> is a powerful way to pass dynamic information from your website to GTM. The <strong>data layer<\/strong> is a JavaScript object that stores and organizes key pieces of data (such as page information, user interactions, or eCommerce details) in a structured way, allowing GTM to easily access and use it for tracking purposes.<\/p>\n<p>This guide explains how to set up and use <strong>data layer variables<\/strong> in GTM to enhance your tracking and measurement capabilities.<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#What_is_the_Data_Layer\" title=\"What is the Data Layer?\">What is the Data Layer?<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Why_Use_Data_Layer_Variables\" title=\"Why Use Data Layer Variables?\">Why Use Data Layer Variables?<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Step-by-Step_Guide_to_Set_Up_and_Use_Data_Layer_Variables\" title=\"Step-by-Step Guide to Set Up and Use Data Layer Variables\">Step-by-Step Guide to Set Up and Use Data Layer Variables<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Step_1_Implement_the_Data_Layer_on_Your_Website\" title=\"Step 1: Implement the Data Layer on Your Website\">Step 1: Implement the Data Layer on Your Website<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Step_2_Access_the_Data_Layer_in_Google_Tag_Manager\" title=\"Step 2: Access the Data Layer in Google Tag Manager\">Step 2: Access the Data Layer in Google Tag Manager<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Step_3_Use_the_Data_Layer_Variable_in_Tags\" title=\"Step 3: Use the Data Layer Variable in Tags\">Step 3: Use the Data Layer Variable in Tags<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Step_4_Preview_and_Test\" title=\"Step 4: Preview and Test\">Step 4: Preview and Test<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Step_5_Publish_Changes\" title=\"Step 5: Publish Changes\">Step 5: Publish Changes<\/a><\/li><\/ul><\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Example_Use_Cases_for_Data_Layer_Variables\" title=\"Example Use Cases for Data Layer Variables\">Example Use Cases for Data Layer Variables<\/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-set-up-and-use-data-layer-variables-in-google-tag-manager\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"What_is_the_Data_Layer\"><\/span>What is the Data Layer?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The <strong>data layer<\/strong> is essentially a container or array that stores information about the page or user interactions in a format that can be easily read and used by Google Tag Manager. It\u2019s typically implemented as JavaScript code on your website.<\/p>\n<p>Example of a data layer object in JavaScript:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary\">javascript<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center py-1\">Copy code<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-javascript\"><span class=\"hljs-variable language_\">window<\/span>.<span class=\"hljs-property\">dataLayer<\/span> = <span class=\"hljs-variable language_\">window<\/span>.<span class=\"hljs-property\">dataLayer<\/span> || [];<br \/>\n<span class=\"hljs-variable language_\">window<\/span>.<span class=\"hljs-property\">dataLayer<\/span>.<span class=\"hljs-title function_\">push<\/span>({<br \/>\n  <span class=\"hljs-string\">'event'<\/span>: <span class=\"hljs-string\">'purchase'<\/span>,<br \/>\n  <span class=\"hljs-string\">'transactionId'<\/span>: <span class=\"hljs-string\">'12345'<\/span>,<br \/>\n  <span class=\"hljs-string\">'transactionTotal'<\/span>: <span class=\"hljs-number\">100.00<\/span>,<br \/>\n  <span class=\"hljs-string\">'transactionProducts'<\/span>: [<br \/>\n    {<br \/>\n      <span class=\"hljs-string\">'productId'<\/span>: <span class=\"hljs-string\">'56789'<\/span>,<br \/>\n      <span class=\"hljs-string\">'productName'<\/span>: <span class=\"hljs-string\">'Cool T-Shirt'<\/span>,<br \/>\n      <span class=\"hljs-string\">'productPrice'<\/span>: <span class=\"hljs-number\">20.00<\/span><br \/>\n    },<br \/>\n    {<br \/>\n      <span class=\"hljs-string\">'productId'<\/span>: <span class=\"hljs-string\">'67890'<\/span>,<br \/>\n      <span class=\"hljs-string\">'productName'<\/span>: <span class=\"hljs-string\">'Jeans'<\/span>,<br \/>\n      <span class=\"hljs-string\">'productPrice'<\/span>: <span class=\"hljs-number\">80.00<\/span><br \/>\n    }<br \/>\n  ]<br \/>\n});<br \/>\n<\/code><\/div>\n<\/div>\n<p>In this example, data like the purchase event, transaction ID, total amount, and products purchased are pushed into the <strong>data layer<\/strong>. GTM can then read this data and use it for tracking events, such as eCommerce tracking.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Why_Use_Data_Layer_Variables\"><\/span>Why Use Data Layer Variables?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Using <strong>Data Layer Variables<\/strong> in GTM offers several advantages:<\/p>\n<ul>\n<li><strong>Dynamic Data Access<\/strong>: You can capture dynamic information (e.g., user IDs, product details, form submissions) from the website that may not be directly available in the page&#8217;s HTML.<\/li>\n<li><strong>Better Tag Management<\/strong>: Data is structured in a consistent way, which makes it easier to pass information to multiple tags (e.g., Google Analytics, Facebook Pixel) without having to manually configure each tag.<\/li>\n<li><strong>Event Tracking<\/strong>: It allows for advanced event tracking beyond simple page views, such as tracking form submissions, purchases, or button clicks with more detailed context.<\/li>\n<li><strong>Flexibility<\/strong>: Data Layer Variables can handle custom events, complex eCommerce transactions, or any other site-specific behavior.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Step-by-Step_Guide_to_Set_Up_and_Use_Data_Layer_Variables\"><\/span>Step-by-Step Guide to Set Up and Use Data Layer Variables<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"Step_1_Implement_the_Data_Layer_on_Your_Website\"><\/span>Step 1: Implement the Data Layer on Your Website<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Before setting up the <strong>Data Layer Variables<\/strong> in Google Tag Manager, you need to implement the <strong>data layer<\/strong> code on your website. The data layer can be initialized and updated with specific data relevant to your tracking needs.<\/p>\n<p><strong>Example<\/strong>: If you&#8217;re tracking product purchases, your developer needs to add the following data layer code to your checkout confirmation page:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary\">javascript<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><span class=\"\" data-state=\"closed\"><button class=\"flex gap-1 items-center py-1\">Copy code<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-javascript\"><span class=\"hljs-variable language_\">window<\/span>.<span class=\"hljs-property\">dataLayer<\/span> = <span class=\"hljs-variable language_\">window<\/span>.<span class=\"hljs-property\">dataLayer<\/span> || [];<br \/>\n<span class=\"hljs-variable language_\">window<\/span>.<span class=\"hljs-property\">dataLayer<\/span>.<span class=\"hljs-title function_\">push<\/span>({<br \/>\n  <span class=\"hljs-string\">'event'<\/span>: <span class=\"hljs-string\">'purchase'<\/span>,<br \/>\n  <span class=\"hljs-string\">'transactionId'<\/span>: <span class=\"hljs-string\">'12345'<\/span>,<br \/>\n  <span class=\"hljs-string\">'transactionTotal'<\/span>: <span class=\"hljs-number\">100.00<\/span>,<br \/>\n  <span class=\"hljs-string\">'transactionProducts'<\/span>: [<br \/>\n    {<br \/>\n      <span class=\"hljs-string\">'productId'<\/span>: <span class=\"hljs-string\">'56789'<\/span>,<br \/>\n      <span class=\"hljs-string\">'productName'<\/span>: <span class=\"hljs-string\">'Cool T-Shirt'<\/span>,<br \/>\n      <span class=\"hljs-string\">'productPrice'<\/span>: <span class=\"hljs-number\">20.00<\/span><br \/>\n    }<br \/>\n  ]<br \/>\n});<br \/>\n<\/code><\/div>\n<\/div>\n<p>This data layer code will push a &#8220;purchase&#8221; event along with relevant details (transaction ID, total, and product info) into the data layer.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Step_2_Access_the_Data_Layer_in_Google_Tag_Manager\"><\/span>Step 2: Access the Data Layer in Google Tag Manager<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Now that the data is available in the <strong>data layer<\/strong>, you need to create variables in GTM to capture and use this data.<\/p>\n<ol>\n<li><strong>Open Google Tag Manager<\/strong>: Go to your GTM workspace.<\/li>\n<li><strong>Navigate to Variables<\/strong>: From the left-hand menu, click on <strong>Variables<\/strong>.<\/li>\n<li><strong>Create a New Data Layer Variable<\/strong>:\n<ul>\n<li>Scroll down to the <strong>User-Defined Variables<\/strong> section and click <strong>New<\/strong>.<\/li>\n<li>Choose <strong>Variable Configuration<\/strong>.<\/li>\n<li>Select <strong>Data Layer Variable<\/strong> from the list of variable types.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Configure the Data Layer Variable<\/strong>:\n<ul>\n<li>In the <strong>Data Layer Variable Name<\/strong> field, enter the name of the data layer variable you want to retrieve from the data layer. The name you enter here must match the key name used in your data layer.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>For example, if you want to capture the <strong>transactionTotal<\/strong>, your variable configuration might look like this:<\/p>\n<ul>\n<li><strong>Data Layer Variable Name<\/strong>: <code>transactionTotal<\/code><\/li>\n<\/ul>\n<ol start=\"5\">\n<li><strong>Set a Default Value (Optional)<\/strong>: You can specify a default value that will be used if the data layer variable isn\u2019t available. This is helpful in preventing errors if the data isn&#8217;t always present.<\/li>\n<\/ol>\n<h4><span class=\"ez-toc-section\" id=\"Step_3_Use_the_Data_Layer_Variable_in_Tags\"><\/span>Step 3: Use the Data Layer Variable in Tags<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Once you&#8217;ve created a data layer variable, you can use it in your tags, triggers, or other variables. Here&#8217;s how you would apply it:<\/p>\n<ol>\n<li><strong>Using the Variable in a Tag<\/strong>:\n<ul>\n<li>Go to <strong>Tags<\/strong> in GTM and either create a new tag or edit an existing one (e.g., Google Analytics event tracking tag).<\/li>\n<li>In the <strong>Tag Configuration<\/strong> section, set up your tag as usual.<\/li>\n<li>When configuring the tag fields (e.g., category, action, label), you can use your <strong>data layer variable<\/strong> by clicking the <strong>variable button<\/strong> (the lego brick icon) and selecting the variable you created earlier.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>Example: For a Google Analytics <strong>event<\/strong> tracking tag, you could use the <strong>transactionTotal<\/strong> data layer variable for the <strong>Event Value<\/strong> field:<\/p>\n<ul>\n<li><strong>Category<\/strong>: Purchase<\/li>\n<li><strong>Action<\/strong>: Completed<\/li>\n<li><strong>Label<\/strong>: {{transactionId}} (another data layer variable you can create)<\/li>\n<li><strong>Value<\/strong>: {{transactionTotal}}<\/li>\n<\/ul>\n<ol start=\"2\">\n<li><strong>Use in Triggers<\/strong>:\n<ul>\n<li>If you want to fire a tag when a specific event occurs, you can use a <strong>data layer event<\/strong> trigger.<\/li>\n<li>Example: To trigger the tag only when a purchase occurs, you can create a trigger that listens for the <code>purchase<\/code> event in the data layer:\n<ul>\n<li><strong>Trigger Type<\/strong>: Custom Event<\/li>\n<li><strong>Event Name<\/strong>: <code>purchase<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4><span class=\"ez-toc-section\" id=\"Step_4_Preview_and_Test\"><\/span>Step 4: Preview and Test<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Before publishing your tags and variables, always test them in GTM&#8217;s <strong>Preview<\/strong> mode to ensure they\u2019re working as expected.<\/p>\n<ol>\n<li><strong>Enter Preview Mode<\/strong>: Click the <strong>Preview<\/strong> button in GTM, and your website will open in debug mode.<\/li>\n<li><strong>Check Data Layer Variables<\/strong>: Navigate through your site, perform the actions that would trigger the relevant data (e.g., a purchase or form submission), and check the <strong>GTM Debug Console<\/strong>.\n<ul>\n<li>In the <strong>Variables<\/strong> tab of the debug console, verify that the <strong>data layer variables<\/strong> are pulling in the correct data.<\/li>\n<li>In the <strong>Tag Assistant<\/strong>, ensure that the relevant tags are firing correctly based on the triggers and variables you set up.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4><span class=\"ez-toc-section\" id=\"Step_5_Publish_Changes\"><\/span>Step 5: Publish Changes<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Once you&#8217;ve tested your variables and confirmed everything is working, publish your container:<\/p>\n<ol>\n<li>Exit preview mode.<\/li>\n<li>Click <strong>Submit<\/strong> in GTM.<\/li>\n<li>Name your version (e.g., &#8220;Data Layer Variables for Purchase Tracking&#8221;) and publish it.<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Example_Use_Cases_for_Data_Layer_Variables\"><\/span>Example Use Cases for Data Layer Variables<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol>\n<li><strong>eCommerce Tracking<\/strong>:\n<ul>\n<li>Capture and send transaction details like product IDs, names, and prices to Google Analytics for eCommerce tracking.<\/li>\n<li>Example: Use <code>transactionId<\/code>, <code>transactionTotal<\/code>, and <code>transactionProducts<\/code> data layer variables to track order completions.<\/li>\n<\/ul>\n<\/li>\n<li><strong>User Information<\/strong>:\n<ul>\n<li>Pass user-specific data (like user IDs or user roles) into the data layer to track user behavior across your site.<\/li>\n<li>Example: Use a <code>userId<\/code> data layer variable to track logged-in users.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Form Submissions<\/strong>:\n<ul>\n<li>Track specific form submissions and form field values through the data layer.<\/li>\n<li>Example: Capture form IDs or field input values like <code>formEmail<\/code> or <code>formPhone<\/code> and send them to analytics or CRM systems.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Enhanced Link Clicks<\/strong>:\n<ul>\n<li>Capture detailed information about button or link clicks.<\/li>\n<li>Example: Use a data layer variable to track the text or URL of a clicked button.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Setting up and using <strong>Data Layer Variables<\/strong> in Google Tag Manager unlocks advanced tracking capabilities by enabling you to capture and utilize dynamic, detailed information from your website. By pushing structured data into the data layer and creating corresponding variables in GTM, you can efficiently manage complex tracking needs, such as eCommerce transactions, form submissions, and custom user interactions. With proper testing and monitoring, you can ensure your tags are firing correctly and data is being sent to the appropriate platforms for analysis.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up and using Data Layer Variables in Google Tag Manager (GTM) is a powerful way to pass dynamic information from your website to GTM&#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-10085","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 set up and use data layer variables 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-set-up-and-use-data-layer-variables-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 set up and use data layer variables in Google Tag Manager - CEOweb Ltd. Blog\" \/>\n<meta property=\"og:description\" content=\"Setting up and using Data Layer Variables in Google Tag Manager (GTM) is a powerful way to pass dynamic information from your website to GTM....\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/\" \/>\n<meta property=\"og:site_name\" content=\"CEOweb Ltd. Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-18T12:48:13+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-set-up-and-use-data-layer-variables-in-google-tag-manager\/\",\"url\":\"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/\",\"name\":\"How to set up and use data layer variables in Google Tag Manager - CEOweb Ltd. Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ceowebltd.com\/blog\/#website\"},\"datePublished\":\"2024-10-18T12:48:13+00:00\",\"dateModified\":\"2024-10-18T12:48:13+00:00\",\"author\":{\"@id\":\"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/4759c204c0b0f1d134ec16e8ec777a6f\"},\"breadcrumb\":{\"@id\":\"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ceowebltd.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set up and use data layer variables 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 set up and use data layer variables 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-set-up-and-use-data-layer-variables-in-google-tag-manager\/","og_locale":"en_US","og_type":"article","og_title":"How to set up and use data layer variables in Google Tag Manager - CEOweb Ltd. Blog","og_description":"Setting up and using Data Layer Variables in Google Tag Manager (GTM) is a powerful way to pass dynamic information from your website to GTM....","og_url":"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/","og_site_name":"CEOweb Ltd. Blog","article_published_time":"2024-10-18T12:48:13+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-set-up-and-use-data-layer-variables-in-google-tag-manager\/","url":"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/","name":"How to set up and use data layer variables in Google Tag Manager - CEOweb Ltd. Blog","isPartOf":{"@id":"https:\/\/ceowebltd.com\/blog\/#website"},"datePublished":"2024-10-18T12:48:13+00:00","dateModified":"2024-10-18T12:48:13+00:00","author":{"@id":"https:\/\/ceowebltd.com\/blog\/#\/schema\/person\/4759c204c0b0f1d134ec16e8ec777a6f"},"breadcrumb":{"@id":"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ceowebltd.com\/blog\/how-to-set-up-and-use-data-layer-variables-in-google-tag-manager\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ceowebltd.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to set up and use data layer variables 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\/10085","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=10085"}],"version-history":[{"count":1,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/posts\/10085\/revisions"}],"predecessor-version":[{"id":10086,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/posts\/10085\/revisions\/10086"}],"wp:attachment":[{"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/media?parent=10085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/categories?post=10085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ceowebltd.com\/blog\/wp-json\/wp\/v2\/tags?post=10085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}