{"id":1957,"date":"2013-10-13T21:04:07","date_gmt":"2013-10-14T02:04:07","guid":{"rendered":"http:\/\/www.powrsurg.com\/blog\/?p=1957"},"modified":"2013-10-13T21:04:07","modified_gmt":"2013-10-14T02:04:07","slug":"offsite-tracking-google-analytics","status":"publish","type":"post","link":"https:\/\/www.powrsurg.com\/blog\/2013\/10\/13\/offsite-tracking-google-analytics\/","title":{"rendered":"Offsite Tracking in Google Analytics"},"content":{"rendered":"<p itemprop=\"description\">Are you interested in adding offsite tracking to your Google Analytics reports? Here is how you can make any link a page in your reports.<!--more--><\/p>\n<h2>Why you should use offsite tracking<\/h2>\n<p>First let me start off by explaining what I mean by offsite tracking. By default Google Analytics will only show you information on <em>pages<\/em> on <em>your site<\/em>. Those are two important distinctions that I hope are clear. They are only showing you information on pages, and they are only showing you information about your site. This makes sense for a number of reasons:<\/p>\n<ul>\n<li>Google cannot know that a link to page on another domain is one that they should associate with your site.<\/li>\n<li>It is the other domain owner&#8217;s right to have information on their own domain.<\/li>\n<li>Non-pages, such as PDF files, hosted on your site cannot run Google Analytics.<\/li>\n<\/ul>\n<p>But sometimes you&#8217;re going to have links that don&#8217;t fit this criteria that are just as important as any page on your site. A link to your Facebook page is no less important to your brand than your About Us page. It might even be more important. You&#8217;re probably displaying it in the header or footer of your site. Why not include it in your reports?<\/p>\n<p>You might also have a <em>call to action<\/em> on your site that directs the user to a non-web page. On the <a href=\"http:\/\/m.trinityhomerenovations.com\/\">mobile website for Trinity Home Renovations<\/a> we include a click to call button. Earlier this week I added code to track when a user clicked on this button. Clicking this button merely brings up the dial pad which we can track. We cannot know if the user made a call, but it is nice to know they got to the point where they considered making a call.<\/p>\n<p>I tested this code in various mobile browsers and then loaded Google Analytics to view the report.<\/p>\n<div id=\"attachment_1958\" style=\"width: 596px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.powrsurg.com\/blog\/wp-content\/uploads\/2013\/10\/offsite-tracking-google-analytics.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1958\" class=\" wp-image-1958 \" alt=\"Mobile browser support for offsite tracking a link in Google Analytics.\" src=\"http:\/\/www.powrsurg.com\/blog\/wp-content\/uploads\/2013\/10\/offsite-tracking-google-analytics.png\" width=\"586\" height=\"215\" srcset=\"https:\/\/www.powrsurg.com\/blog\/wp-content\/uploads\/2013\/10\/offsite-tracking-google-analytics.png 837w, https:\/\/www.powrsurg.com\/blog\/wp-content\/uploads\/2013\/10\/offsite-tracking-google-analytics-300x110.png 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/a><p id=\"caption-attachment-1958\" class=\"wp-caption-text\">Google Analytics can report the number of clicks on a &#8220;click to call&#8221; button on a mobile website.<\/p><\/div>\n<p>Google Analytics successfully reported the clicks from every mobile browser, except Opera Mini. Given the low usage volume for Opera Mini this not much of a concern.<\/p>\n<h2>How to configure offsite tracking<\/h2>\n<p>It is very easy to configure offsite tracking for a link on your site. Suppose you wanted to link to your Facebook page. The HTML code for that would look like:<\/p>\n<p><code>&lt;a href=\"https:\/\/www.facebook.com\/BrandBuilderCompany\"&gt;Visit us on Facebook&lt;\/a&gt;<\/code><\/p>\n<p>You would simply need to add an <code>onclick<\/code> attribute that tells <a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/gajs\/methods\/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview\">Google Analytics to record the click as a page<\/a>, and to give that page a name. It would look like:<\/p>\n<p><code>&lt;a href=\"https:\/\/www.facebook.com\/BrandBuilderCompany\" onclick=\"<code>_gaq.push(['_trackPageview','\/FacebookPage']);<\/code>\"&gt;Visit us on Facebook&lt;\/a&gt;<\/code><\/p>\n<p>In this example I gave the link the page name &#8220;\/FacebookPage&#8221;. I included the &#8220;\/&#8221; so that the page name looks like every other page in Google Analytics. I&#8217;d recommend avoiding spaces in the page name. I&#8217;m not sure what would happen and it&#8217;s very bad practice to have spaces in your URLs anyways.<\/p>\n<p>That&#8217;s all you need to do . Just add a bit of code and you are now tracking clicks on offsite pages from your website.<\/p>\n<p>This post was originally published as <a href=\"http:\/\/www.brandbuilderwebsites.com\/blog\/2013\/10\/10\/offsite-tracking-google-analytics\/\">Offsite Tracking in Google Analytics<\/a> for <a href=\"http:\/\/www.brandbuilderwebsites.com\/\">Brand Builder Websites<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you interested in adding offsite tracking to your Google Analytics reports? Here is how you can make any link a page in your reports.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,65,53],"tags":[130],"class_list":["post-1957","post","type-post","status-publish","format-standard","hentry","category-google-2","category-marketing","category-search-engine-optimization","tag-google-analytics"],"_links":{"self":[{"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/posts\/1957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/comments?post=1957"}],"version-history":[{"count":3,"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/posts\/1957\/revisions"}],"predecessor-version":[{"id":1961,"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/posts\/1957\/revisions\/1961"}],"wp:attachment":[{"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/media?parent=1957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/categories?post=1957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.powrsurg.com\/blog\/wp-json\/wp\/v2\/tags?post=1957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}