{"id":103909,"date":"2025-02-22T19:18:55","date_gmt":"2025-02-22T19:18:55","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/gtmtips-format-value-option-in-google-tag-manager-variables\/"},"modified":"2025-02-22T19:18:55","modified_gmt":"2025-02-22T19:18:55","slug":"gtmtips-format-value-option-in-google-tag-manager-variables","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=103909","title":{"rendered":"#GTMTips: Format Value Option In Google Tag Manager Variables"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>A very recent addition to <a href=\"https:\/\/tagmanager.google.com\/\">Google Tag Manager<\/a> is the <strong>Format Value<\/strong> option in all of <a href=\"https:\/\/www.simoahava.com\/analytics\/variable-guide-google-tag-manager\/\">GTM\u2019s variables<\/a>. With Format Value, you can modify the output of the variable with a number of pre-defined transformations.<\/p>\n<p>This is extremely handy, because you no longer need to create Custom JavaScript variables whose sole purpose of existence it to change the output of <em>other<\/em> variables to lowercase, or to change <code>undefined<\/code> values to fallback strings (e.g. <code>(not set)<\/code>).<\/p>\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=\"tip-88-format-value-option-in-gtms-variables\">Tip 88: Format Value option in GTM\u2019s Variables<\/h2>\n<div style=\"aspect-ratio: 960 \/ 540;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2018\/09\/format-value-variables.jpg\" title=\"Format Value option in GTM's variables\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"540\" width=\"960\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2018\/09\/format-value-variables.jpg#ZgotmplZ\" alt=\"Format Value option in GTM's variables\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>When you create or modify any <strong>variable<\/strong> in GTM, you now see a new option at the bottom of the configuration screen. The option is titled <strong>Format Value<\/strong>. By expanding it, you will see the following options:<\/p>\n<ul>\n<li>\n<p><strong>Change Case to\u2026<\/strong> &#8211; This lets you change the case of the string output of the variable to either <code>lowercase<\/code> or <code>UPPERCASE<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Convert <code>null<\/code> to\u2026<\/strong> &#8211; With this, you can convert <code>null<\/code> values to some other string (by typing text directly into the field), or you can have <code>null<\/code> output fall back to another variable by picking it from the variable selector.<\/p>\n<\/li>\n<li>\n<p><strong>Convert <code>undefined<\/code> to\u2026<\/strong> &#8211; Same as with <code>null<\/code>, you can now have <code>undefined<\/code> values fall back to strings or the returned value of other variables.<\/p>\n<\/li>\n<li>\n<p><strong>Convert <code>true<\/code> to\u2026<\/strong> &#8211; Same as above, except now you can convert Boolean <code>true<\/code> to a string or the returned value of some other variable.<\/p>\n<\/li>\n<li>\n<p><strong>Convert <code>false<\/code> to\u2026<\/strong> &#8211; Same as above, except now you can convert Boolean <code>false<\/code> to a string or the returned value of some other variable.<\/p>\n<\/li>\n<\/ul>\n<p>So how is this useful? Well, take the <strong>Case<\/strong> conversion as an example. By forcing the variable output to lowercase, for example, you can normalize all the following strings:<\/p>\n<p><code>\"I love GTM\"<\/code>, <code>\"i LoVe gTM\"<\/code>, <code>\"I LOVE GTM\"<\/code>.<\/p>\n<p>With <strong>Case<\/strong> conversion set to <strong>Lowercase<\/strong>, the output of all the three strings above would be <code>\"i love gtm\"<\/code>.<\/p>\n<p>Normalization is absolutely vital in tools such as <a href=\"https:\/\/analytics.google.com\">Google Analytics<\/a>, which treat each case format of any string as unique and distinct from the others.<\/p>\n<p>Being able to convert <em>falsy<\/em> values such as <code>undefined<\/code>, <code>null<\/code> and <code>false<\/code> to string representations is handy, too, since you can now use something like <code>\"N\/A\"<\/code> or <code>\"(not set)\"<\/code> to represent situations where the variable did not return a proper value. Again, in Google Analytics this is relevant, because <a href=\"https:\/\/www.simoahava.com\/gtm-tips\/undefined-dimensions-wont-get-sent\/\">GA drops <code>undefined<\/code> fields from hits<\/a>.<\/p>\n<p>The <strong>Format Value<\/strong> option is a very useful addition to Google Tag Manager\u2019s arsenal. I only hope the number of available formatting options is increased in the future, perhaps even allowing us to write simple anonymous functions directly in the UI through which each varible output is passed.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>A very recent addition to Google Tag Manager is the Format Value option in all of GTM\u2019s variables. With Format Value, you can modify the output of the variable with a number of pre-defined transformations. This is extremely handy, because you no longer need to create Custom JavaScript variables whose sole purpose of existence it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":103912,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[18585,1531,14492,14495,20805,1791,30217],"dealstore":[],"offerexpiration":[],"class_list":["post-103909","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-format","tag-google","tag-gtmtips","tag-manager","tag-option","tag-tag","tag-variables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>#GTMTips: Format Value Option In Google Tag Manager Variables - 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=103909\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"#GTMTips: Format Value Option In Google Tag Manager Variables - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"A very recent addition to Google Tag Manager is the Format Value option in all of GTM\u2019s variables. With Format Value, you can modify the output of the variable with a number of pre-defined transformations. This is extremely handy, because you no longer need to create Custom JavaScript variables whose sole purpose of existence it [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=103909\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-22T19:18:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=103909#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=103909\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"#GTMTips: Format Value Option In Google Tag Manager Variables\",\"datePublished\":\"2025-02-22T19:18:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=103909\"},\"wordCount\":445,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=103909#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg\",\"keywords\":[\"Format\",\"Google\",\"GTMTips\",\"Manager\",\"Option\",\"TAG\",\"Variables\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=103909#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=103909\",\"url\":\"https:\/\/fivemor.com\/?p=103909\",\"name\":\"#GTMTips: Format Value Option In Google Tag Manager Variables - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=103909#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=103909#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg\",\"datePublished\":\"2025-02-22T19:18:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=103909#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=103909\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=103909#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=103909#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"#GTMTips: Format Value Option In Google Tag Manager Variables\"}]},{\"@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":"#GTMTips: Format Value Option In Google Tag Manager Variables - 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=103909","og_locale":"en_US","og_type":"article","og_title":"#GTMTips: Format Value Option In Google Tag Manager Variables - Som2ny Network","og_description":"A very recent addition to Google Tag Manager is the Format Value option in all of GTM\u2019s variables. With Format Value, you can modify the output of the variable with a number of pre-defined transformations. This is extremely handy, because you no longer need to create Custom JavaScript variables whose sole purpose of existence it [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=103909","og_site_name":"Som2ny Network","article_published_time":"2025-02-22T19:18:55+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=103909#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=103909"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"#GTMTips: Format Value Option In Google Tag Manager Variables","datePublished":"2025-02-22T19:18:55+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=103909"},"wordCount":445,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=103909#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg","keywords":["Format","Google","GTMTips","Manager","Option","TAG","Variables"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=103909#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=103909","url":"https:\/\/fivemor.com\/?p=103909","name":"#GTMTips: Format Value Option In Google Tag Manager Variables - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=103909#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=103909#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg","datePublished":"2025-02-22T19:18:55+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=103909#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=103909"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=103909#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/format-value-variables.jpg","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=103909#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"#GTMTips: Format Value Option In Google Tag Manager Variables"}]},{"@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\/103909","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=103909"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/103909\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/103912"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=103909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=103909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=103909"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=103909"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=103909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}