{"id":164839,"date":"2025-03-30T11:25:20","date_gmt":"2025-03-30T11:25:20","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/fix-ga-site-search-with-google-tag-manager\/"},"modified":"2025-03-30T11:25:20","modified_gmt":"2025-03-30T11:25:20","slug":"fix-ga-site-search-with-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=164839","title":{"rendered":"Fix GA Site Search With Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>Analyzing what people write in your <a href=\"https:\/\/support.google.com\/analytics\/answer\/1012264?hl=en\">site search field<\/a> is pretty much one of the smartest things you can do for your website tracking. If certain terms pop up over and over again in internal search reports, it means that your site is not providing the answers people are looking for, meaning you have an excellent opportunity to provide supply for the demand!<\/p>\n<div style=\"aspect-ratio: 1075 \/ 264;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/search-report.jpg\" title=\"Search Reports in GA\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"264\" width=\"1075\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/search-report.jpg#ZgotmplZ\" alt=\"Search Reports in GA\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>However, not all site search applications are trackable out-of-the-box. In this post, I go over three scenarios, and I provide three solutions for tackling internal site search problems in <a href=\"https:\/\/www.google.com\/tagmanager\">Google Tag Manager<\/a>.<\/p>\n<p><strong>1) No query parameter in URL<\/strong><\/p>\n<p>Google Analytics\u2019 site search settings require a query parameter in the URL, e.g. <code>https:\/\/www.simoahava.com\/search?q=analytics<\/code>. Often, however, the site search tool does not apply a query parameter to the URL. Rather, the keyword might be as a typical URL folder, like <code>https:\/\/www.simoahava.com\/search\/analytics<\/code>.<\/p>\n<p>This is pretty commonplace. You might have seen this phenomenon in <a href=\"https:\/\/www.drupal.org\/documentation\/modules\/search\">Drupal<\/a> websites. It\u2019s easy to fix with a URL macro and the <strong>page<\/strong> field in your pageview tag.<\/p>\n<p><strong>2) No search term in URL<\/strong><\/p>\n<p>This is a bit more difficult, since you can\u2019t use the URL anymore. This means that the URL stays the same (or has some generic search path), and you need to look into on-page elements for information on what the user searched for. Some DOM scraping and the <strong>page<\/strong> field should do the trick.<\/p>\n<p><strong>3) Nothing on the page to use<\/strong><\/p>\n<p>This is the most difficult scenario to handle, since there\u2019s nothing on the page for you to latch on to. Perhaps the search term isn\u2019t iterated (stupid), or it\u2019s not contained in a DOM element (stupid, stupid). This time, we\u2019ll try to get the value of the search field in the form submit event, and pass that as a virtual pageview.<\/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=\"1-no-query-parameter-in-url\">1) No query parameter in URL<\/h2>\n<div style=\"aspect-ratio: 1399 \/ 504;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/search-without-parameter.jpg\" title=\"Site search without query parameter\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"504\" width=\"1399\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/search-without-parameter.jpg#ZgotmplZ\" alt=\"Site search without query parameter\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>I see this pretty often. You have a search tool but it doesn\u2019t utilize a query parameter for the search term. Rather, it displays the keyword in a virtual folder in the URI. Nothing wrong with that, though every CMS should let you choose how the search terms are displayed in the URL.<\/p>\n<p>This is what you\u2019re going to do:<\/p>\n<ol>\n<li>\n<p>In your ordinary pageview tag, you click open the <strong>Fields to set<\/strong> setting, and you add a new field with <strong>page<\/strong> as the field name. Field value would be the reference to a Custom JavaScript Macro <code>{{search path}}<\/code>.<\/p>\n<\/li>\n<li>\n<p>This macro will look for the search term in the URL<\/p>\n<\/li>\n<li>\n<p>If it finds a search term, it will return the modified document path with the search term as a query parameter<\/p>\n<\/li>\n<li>\n<p>If no search term is found, the macro returns false, meaning the document path will not be modified, and the pageview will fire normally<\/p>\n<\/li>\n<\/ol>\n<p>That\u2019s the beauty of GTM, again. Since the macro returns false for non-search pageviews, you\u2019ll just need the one, single, normal, ordinary pageview tag to cover all the searches as well. No need for extra tags, woohoo!<\/p>\n<p>So, let\u2019s say that the site search term is displayed like it\u2019s displayed on <a href=\"https:\/\/www.drupal.org\">www.drupal.org<\/a>: \/search\/site\/<strong>keyword<\/strong>. The <code>{{search path}}<\/code> macro should first check if the URI starts with \/search\/site\/, and if it does, it should return whatever comes after, properly modified into a proper path.<\/p>\n<p>Here\u2019s the code for the <code>{{search path}}<\/code> macro:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">function<\/span>() {\n  <span style=\"color:#00a\">var<\/span> regex = <span style=\"color:#099\">\/^\\\/search\\\/site\\\/(.*)\/<\/span>;\n  <span style=\"color:#00a\">if<\/span>(regex.test({{url path}})) {\n    <span style=\"color:#00a\">return<\/span> <span style=\"color:#a50\">\"\/search\/site?q=\"<\/span> + regex.exec({{url path}})[<span style=\"color:#099\">1<\/span>];\n  }\n  <span style=\"color:#00a\">return<\/span>;\n}\n<\/code><\/pre>\n<\/div>\n<p>The regular expression looks at the <code>{{url path}}<\/code> macro (which stores the current URI of the page), and if the path starts with \/search\/site\/, it returns a modified version of the URI with the search term appended as the value of the query parameter <strong>q<\/strong>. Change this parameter to reflect whatever you want to have in your Google Analytics view\u2019s site search settings.<\/p>\n<p>Finally, just edit your pageview tag, add a new field to <strong>Fields to set<\/strong>, set <strong>page<\/strong> as the field name, and add your macro as its value. That\u2019s all there is to it!<\/p>\n<div style=\"aspect-ratio: 1398 \/ 532;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/document-path-in-tag1.jpg\" title=\"Page in the Fields To Set\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"532\" width=\"1398\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/document-path-in-tag1.jpg#ZgotmplZ\" alt=\"Page in the Fields To Set\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Don\u2019t forget to do some Preview &amp; Debugging, and also check with a debugger like <a href=\"http:\/\/webanalyticssolutionprofiler.com\/\">WASP<\/a> to see if the path gets sent correctly for search terms (and correctly for all other pages as well!).<\/p>\n<div style=\"aspect-ratio: 405 \/ 120;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/document-path.jpg\" title=\"Check with WASP\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"120\" width=\"405\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/document-path.jpg#ZgotmplZ\" alt=\"Check with WASP\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h2 id=\"2-no-search-term-in-url\">2) No search term in URL<\/h2>\n<p>OK, this one is a bit trickier. In this case, there\u2019s no search term in the URL for you to use. This solution requires that the search term is explicitly presented in an HTML element we can grab onto. The best way is to have it in a <code>span<\/code> or <code>div<\/code> with a unique ID attribute. Since it\u2019s the best way, it\u2019s the one I\u2019ll be using in this example, with a <code><span\/><\/code> element as the wrapper. Feel free to get creative with the DOM if your search term is hidden deeper in the page.<\/p>\n<div style=\"aspect-ratio: 1292 \/ 507;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/search-term-in-dom.jpg\" title=\"Search Term in an HTML element on the page\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"507\" width=\"1292\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/search-term-in-dom.jpg#ZgotmplZ\" alt=\"Search Term in an HTML element on the page\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>For this to work, this is what happens:<\/p>\n<ol>\n<li>\n<p>In your ordinary pageview tag, you click open the <strong>Fields to set<\/strong> setting, and you add a new field with <strong>page<\/strong> as the field name. Field value would be the reference to a Custom JavaScript Macro <code>{{search path}}<\/code><\/p>\n<\/li>\n<li>\n<p>This macro will look for the search term in the HTML element with the ID you specify, using a new DOM Element Macro <code>{{search term}}<\/code><\/p>\n<\/li>\n<li>\n<p>If it finds a search term, the <code>{{search path}}<\/code> macro will return the modified document path with the search term as a query parameter<\/p>\n<\/li>\n<li>\n<p>If no search term is found, the macro returns false, meaning the Document Path will not be modified, and the pageview will fire normally<\/p>\n<\/li>\n<\/ol>\n<p>First, let\u2019s create the DOM Element Macro <code>{{search term}}<\/code>.<\/p>\n<div style=\"aspect-ratio: 340 \/ 411;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/dom-element.jpg\" title=\"DOM Element Macro with site search term\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"411\" width=\"340\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/dom-element.jpg#ZgotmplZ\" alt=\"DOM Element Macro with site search term\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Replace the <strong>Element ID<\/strong> field with whatever your page is using.<\/p>\n<p>Next, we\u2019ll need to edit the Custom JavaScript Macro <code>{{search path}}<\/code>:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">function<\/span>() {\n  <span style=\"color:#00a\">if<\/span>({{search term}} &amp;&amp; {{search term}} !== <span style=\"color:#a50\">'null'<\/span>) {\n    <span style=\"color:#00a\">return<\/span> <span style=\"color:#a50\">\"\/search\/site?q=\"<\/span> + {{search term}};\n  }\n  <span style=\"color:#00a\">return<\/span>;\n}\n<\/code><\/pre>\n<\/div>\n<p>So first we check if an element with the ID you specify exists. If it does, the macro returns <code>\"\/search\/site?q=<keyword>\"<\/keyword><\/code> as the document path, same as in the previous example. If no such element is found, the macro returns false, and the original document path (i.e. the URI of the page the visitor is on) is sent.<\/p>\n<p>The final step is the same as before: edit your pageview tag, add a new field to the <strong>Fields to set<\/strong>, set the field name to <strong>page<\/strong>, and add this <code>{{search path}}<\/code> macro as the field value.<\/p>\n<p>Oh, and don\u2019t forget to preview, debug, and test, test, test.<\/p>\n<h2 id=\"3-nothing-on-the-page-to-use\">3) Nothing on the page to use<\/h2>\n<p>This is bleak, but it happens. There\u2019s absolutely <em>nothing<\/em> in the document object model that you can use to grab the search term. The URL is blank, there\u2019s no search term printed on the page, no fairies whispering in your ear, NOTHING. I know, it sucks. Fire your developer. Just kidding. No, seriously, fire them. Yeah, I\u2019m just kidding.<\/p>\n<p>I\u2019ve chosen to fix this using <a href=\"https:\/\/www.simoahava.com\/analytics\/form-tracking-google-tag-manager\/\">form tracking<\/a>. It basically requires that your search field has some unique identifier you can grab hold of in the submit event. I hope you have a proper ID for the field (or at least a CLASS or NAME!). I\u2019m using ID here, again, but feel free to modify the script to get the value of the page.<\/p>\n<p>The thing is, you\u2019ll need to send a virtual pageview with the form submission, and it will have the search term in the Document Path as in the previous examples. However, if you send a new pageview with the search, you\u2019ll be double-counting your search views, since you\u2019ll be sending a pageview for when the search page loads as well! You don\u2019t want that. That\u2019s why this case is a bit more complex, as you\u2019ll be using a <em>browser cookie<\/em> to carry the search term into the search page pageview, so you can then use that as the document path.<\/p>\n<p>Here\u2019s what\u2019s happening:<\/p>\n<ol>\n<li>\n<p>Have a Form Submit Listener tag firing on all pages<\/p>\n<\/li>\n<li>\n<p>Create a new Custom HTML Tag which fires upon <strong><code>{{event}}<\/code> equals gtm.formSubmit<\/strong>, i.e. when a form is submitted<\/p>\n<\/li>\n<li>\n<p>In this tag verify that a search was made, and retrieve the search term using a DOM Element Macro <code>{{search field value}}<\/code><\/p>\n<\/li>\n<li>\n<p>In the tag, save this search term in a new browser cookie named \u201ckeyword\u201d<\/p>\n<\/li>\n<li>\n<p>Create a new 1st Party Cookie Macro <code>{{cookie search term}}<\/code>, which retrieves this cookie value<\/p>\n<\/li>\n<li>\n<p>In the <code>{{search path}}<\/code> Custom JavaScript Macro, check if cookie exists; if it does, use that as the virtual page path<\/p>\n<\/li>\n<li>\n<p>Utilize <code>{{search path}}<\/code> as the value of a new field in the <strong>Fields to set<\/strong> settings of the Tag. Set the field name to <strong>page<\/strong> and the macro as the field value.<\/p>\n<\/li>\n<li>\n<p>Create a new Custom JavaScript Macro <code>{{searchCallback}}<\/code>, which deletes the cookie in the callback function of the pageview tag<\/p>\n<\/li>\n<\/ol>\n<p>PHEW!<\/p>\n<p>First, the Form Submit Listener. This is easy, just create a new tag of type Form Submit Listener, and have it fire on all pages.<\/p>\n<div style=\"aspect-ratio: 1034 \/ 582;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/form-submit-listener.jpg\" title=\"Form Submit Listener tag\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"582\" width=\"1034\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/form-submit-listener.jpg#ZgotmplZ\" alt=\"Form Submit Listener tag\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>After that, create the DOM Element Macro <code>{{search field value}}<\/code>. Be sure to change the <strong>Element ID<\/strong> setting to the ID of the form field your webpage uses in site search.<\/p>\n<div style=\"aspect-ratio: 341 \/ 404;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/dom-form-search-value.jpg\" title=\"DOM Element Macro for field value\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"404\" width=\"341\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/dom-form-search-value.jpg#ZgotmplZ\" alt=\"DOM Element Macro for field value\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, create a new Custom HTML Tag which fires upon <strong><code>{{event}}<\/code> equals gtm.formSubmit<\/strong>. Have the following code within:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-html\" data-lang=\"html\">script&gt;\n  <span style=\"color:#00a\">if<\/span>({{search field value}} &amp;&amp; {{search field value}} !== <span style=\"color:#a50\">'null'<\/span>) {\n    <span style=\"color:#0aa\">document<\/span>.cookie = <span style=\"color:#a50\">\"keyword=\"<\/span>+{{search field value}}+<span style=\"color:#a50\">\";path=\/\"<\/span>;\n  }\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>Here we look for an HTML element with the ID \u201csearch-field\u201d, and with a VALUE attribute. If this is found, then the content of this attribute is set into a new cookie named \u201ckeyword\u201d. This is, in fact, whatever was typed into the search field at the time of form submission.<\/p>\n<p>(<strong>NOTE!<\/strong> If there are multiple forms on a page, you might want to enhance this tag with a check that it was actually the search form that was submitted. It\u2019s possible that another form is submitted with text in the search field, and this script would then falsely interpret this event as a submission of the site search form.)<\/p>\n<p>Next, create a new 1st Party Cookie Macro, which retrieves the value from the \u201ckeyword\u201d cookie. Call this <code>{{cookie search term}}<\/code>.<\/p>\n<div style=\"aspect-ratio: 547 \/ 330;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/cookie-macro-keyword.jpg\" title=\"1st Party Cookie Macro for keyword\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"330\" width=\"547\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/cookie-macro-keyword.jpg#ZgotmplZ\" alt=\"1st Party Cookie Macro for keyword\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, modify the Custom JavaScript Macro <code>{{search path}}<\/code> to look like this:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">function<\/span>() {\n  <span style=\"color:#00a\">if<\/span>({{cookie search term}}) {\n    <span style=\"color:#00a\">return<\/span> <span style=\"color:#a50\">\"\/search\/site?q=\"<\/span> + {{cookie search term}};\n  }\n  <span style=\"color:#00a\">return<\/span>;\n}\n<\/code><\/pre>\n<\/div>\n<p>So, first we check if the cookie exists. If it does, then its value is returned as a properly formatted Document Path for the pageview tag.<\/p>\n<p>Finally, create a new Custom JavaScript Macro <code>{{searchCallback}}<\/code>, which looks like this:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">function<\/span>() {\n  <span style=\"color:#00a\">if<\/span>({{cookie search term}}) {\n    <span style=\"color:#00a\">return<\/span> <span style=\"color:#00a\">function<\/span>() {\n      <span style=\"color:#0aa\">document<\/span>.cookie = <span style=\"color:#a50\">\"keyword=;path=\/;expires=Thu, 01-Jan-70 00:00:01 GMT\"<\/span>;\n    }\n  }\n  <span style=\"color:#00a\">return<\/span>;\n}\n<\/code><\/pre>\n<\/div>\n<p>This looks for the \u201ckeyword\u201d cookie, and if one is found, then the cookie is deleted. This is extremely important, since you don\u2019t want to keep on sending the virtual pageview with every single page load! Cookies are deleted by setting their expiration date to the past.<\/p>\n<p>Put these all together in your pageview tag, utilizing the <strong>Fields to set<\/strong> with both <strong>hitCallback<\/strong> and <strong>page<\/strong> populated accordingly.<\/p>\n<div style=\"aspect-ratio: 1378 \/ 630;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/07\/pageview-tag-with-changes1.jpg\" title=\"Pageview tag with changes\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"630\" width=\"1378\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/07\/pageview-tag-with-changes1.jpg#ZgotmplZ\" alt=\"Pageview tag with changes\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Why have the cookie deletion in the hitCallback and not in the macro which returns the document path? Well, two reasons:<\/p>\n<ol>\n<li>\n<p>A macro shouldn\u2019t be used to set anything. The callback macro is obviously an exception, since it RETURNS a function which sets something.<\/p>\n<\/li>\n<li>\n<p>There\u2019s some weird race condition in play, and if you refer to the 1st Party Cookie macro in the same script which also deletes the cookie, the macro returns an undefined. I\u2019ll have to research this phenomenon a bit more.<\/p>\n<\/li>\n<\/ol>\n<p>This was way more difficult than the other methods, and let\u2019s face it: If you need to resort to the form submission, you should probably flog your developer first. Make them create a site search engine that actually works with analytics, since it really is one of the best things you can measure.<\/p>\n<h2 id=\"conclusions\">Conclusions<\/h2>\n<p>I was long overdue a traditional tutorial post, so I hope you\u2019ve enjoyed this one. I\u2019m still working on the JavaScript for GTM: Part 2 (<a href=\"https:\/\/www.simoahava.com\/analytics\/javascript-101-gtm-part-1\/\">check Part 1 here<\/a>), but now I\u2019m also dreaming about the mini-vacation that starts tomorrow.<\/p>\n<p>However, if this post raises any questions, if you have other ideas for tracking site search, or if you have a problem you need help with, feel free to drop a line below in the comments! Nothing like a JavaScript challenge to make summer more fun.<\/p>\n<p>Have a great, warm, relaxing summer, my friends! Live life to the fullest, and dream of JavaScript and all things wonderful.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Analyzing what people write in your site search field is pretty much one of the smartest things you can do for your website tracking. If certain terms pop up over and over again in internal search reports, it means that your site is not providing the answers people are looking for, meaning you have an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":164840,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[8678,1531,14495,5476,7476,1791],"dealstore":[],"offerexpiration":[],"class_list":["post-164839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-fix","tag-google","tag-manager","tag-search","tag-site","tag-tag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Fix GA Site Search With 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=164839\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fix GA Site Search With Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"Analyzing what people write in your site search field is pretty much one of the smartest things you can do for your website tracking. If certain terms pop up over and over again in internal search reports, it means that your site is not providing the answers people are looking for, meaning you have an [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=164839\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-30T11:25:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1\" \/>\n\t<meta property=\"og:image:height\" content=\"1\" \/>\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=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=164839#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=164839\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Fix GA Site Search With Google Tag Manager\",\"datePublished\":\"2025-03-30T11:25:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=164839\"},\"wordCount\":2021,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=164839#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg\",\"keywords\":[\"FIX\",\"Google\",\"Manager\",\"search\",\"SITE\",\"TAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=164839#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=164839\",\"url\":\"https:\/\/fivemor.com\/?p=164839\",\"name\":\"Fix GA Site Search With Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=164839#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=164839#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg\",\"datePublished\":\"2025-03-30T11:25:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=164839#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=164839\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=164839#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=164839#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fix GA Site Search With 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":"Fix GA Site Search With 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=164839","og_locale":"en_US","og_type":"article","og_title":"Fix GA Site Search With Google Tag Manager - Som2ny Network","og_description":"Analyzing what people write in your site search field is pretty much one of the smartest things you can do for your website tracking. If certain terms pop up over and over again in internal search reports, it means that your site is not providing the answers people are looking for, meaning you have an [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=164839","og_site_name":"Som2ny Network","article_published_time":"2025-03-30T11:25:20+00:00","og_image":[{"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg","width":1,"height":1,"type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=164839#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=164839"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Fix GA Site Search With Google Tag Manager","datePublished":"2025-03-30T11:25:20+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=164839"},"wordCount":2021,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=164839#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg","keywords":["FIX","Google","Manager","search","SITE","TAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=164839#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=164839","url":"https:\/\/fivemor.com\/?p=164839","name":"Fix GA Site Search With Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=164839#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=164839#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg","datePublished":"2025-03-30T11:25:20+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=164839#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=164839"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=164839#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/search-report.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=164839#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Fix GA Site Search With 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\/164839","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=164839"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/164839\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/164840"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164839"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=164839"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=164839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}