{"id":1258,"date":"2018-01-11T18:48:13","date_gmt":"2018-01-11T18:48:13","guid":{"rendered":"http:\/\/support.gaconnector.com\/?p=1258"},"modified":"2020-05-21T06:43:50","modified_gmt":"2020-05-21T06:43:50","slug":"how-to-add-the-whole-referral-urls-to-the-pages-visited-field","status":"publish","type":"post","link":"https:\/\/gaconnector.com\/docs\/how-to-add-the-whole-referral-urls-to-the-pages-visited-field\/","title":{"rendered":"How to add the whole referral URLs to the &#8220;pages visited&#8221; field"},"content":{"rendered":"<p>Some customers prefer to\u00a0see the full referral URLs in the &#8220;pages visited&#8221; field (not just the path).<\/p>\n<p>For that reason, we created a slightly updated version of GA Connector tracking code that does just that:<\/p>\n<pre class=\"lang:default decode:true \">&lt;script data-cfasync=\"false\" type=\"text\/javascript\" src=\"https:\/\/tracker.gaconnector.com\/gaconnector.js\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\n\tfunction addFullPathToPagesVisited(gaFields) {\r\n\t\tvar prefix = window.location.protocol + \":\/\/\" + window.location.host;\r\n\r\n\t\tvar pagesVisitedList = gaFields['pages_visited_list'];\r\n\t\tpagesVisitedList = pagesVisitedList.replace(\/\\|\/g, \"|\"+prefix);\r\n\t\tpagesVisitedList = prefix + pagesVisitedList;\r\n\r\n\t\tgaFields['pages_visited_list'] = pagesVisitedList;\r\n\t\treturn gaFields;\r\n\t}\r\n\r\n    function setGaconnectorHiddenFields() {\r\n        var gaFields = gaconnector.getCookieValues();\r\n        gaFields = addFullPathToPagesVisited(gaFields);\r\n        for (var fieldName in gaFields) {\r\n            var selectors = 'form input[name=\"' + fieldName + '\"], form input#' + fieldName + ', form input#field_' + fieldName + ', form input[name=\"' + fieldName.toLowerCase() + '\"], form input#' + fieldName.toLowerCase() + ', form input#field_' + fieldName.toLowerCase();\r\n            var inputs = document.querySelector(selectors);\r\n            if (inputs === null) {\r\n                continue;\r\n            } else if (typeof inputs.length === 'undefined') {\r\n                inputs.value = gaFields[fieldName];\r\n            } else {\r\n                for (var i = 0; i &lt; inputs.length; i++) {\r\n                    inputs[i].value = gaFields[fieldName];\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    gaconnector.setCallback(setGaconnectorHiddenFields);\r\n    setInterval(setGaconnectorHiddenFields, 1000);\r\n&lt;\/script&gt;<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some customers prefer to\u00a0see the full referral URLs in the &#8220;pages visited&#8221; field (not just the path). For that reason, we created a slightly updated version of GA Connector tracking code that does just that: &lt;script data-cfasync=&#8221;false&#8221; type=&#8221;text\/javascript&#8221; src=&#8221;https:\/\/tracker.gaconnector.com\/gaconnector.js&#8221;&gt;&lt;\/script&gt; &lt;script&gt; function addFullPathToPagesVisited(gaFields) { var prefix = window.location.protocol + &#8220;:\/\/&#8221; + window.location.host; var pagesVisitedList = gaFields[&#8216;pages_visited_list&#8217;]; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/1258"}],"collection":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/comments?post=1258"}],"version-history":[{"count":1,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/1258\/revisions"}],"predecessor-version":[{"id":1259,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/1258\/revisions\/1259"}],"wp:attachment":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/media?parent=1258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/categories?post=1258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/tags?post=1258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}