{"id":477,"date":"2012-11-19T15:43:53","date_gmt":"2012-11-19T13:43:53","guid":{"rendered":"https:\/\/polyetilen.lt\/?p=477"},"modified":"2023-04-20T13:40:45","modified_gmt":"2023-04-20T10:40:45","slug":"outbound-links-click-tracking-with-google-analytics","status":"publish","type":"post","link":"https:\/\/polyetilen.lt\/en\/outbound-links-click-tracking-with-google-analytics","title":{"rendered":"Outbound links click tracking with Google Analytics"},"content":{"rendered":"<p>Google Analytics allows you to create events and track them. It can be used to track clicks on links to external sites. For example, we need to track only the outbound links and email clicks, then with jQuery filter links and register a click.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n$(document).ready(function(){\r\n\t$('a').not('&#x5B;href^=&quot;' + document.location.protocol + '\/\/' + document.domain + '&quot;]').filter('&#x5B;href^=&quot;http:\/\/&quot;], &#x5B;href^=&quot;https:\/\/&quot;], &#x5B;href^=&quot;mailto:&quot;]').click(function(){\r\n\t\t\/\/for asynchronous google analytics code\r\n\t\t_gaq.push(&#x5B;'_trackEvent', 'Outbound Link', 'Click', $(this).attr('href')]);\r\n\t});\r\n})\r\n<\/pre>\n<p>Links and email addresses will be in event category \"Outbound Link\" with action \"Click\".<br \/>\n<a href=\"https:\/\/developers.google.com\/analytics\/devguides\/collection\/gajs\/eventTrackerGuide\">Google Analytics Event Tracking Guide<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Analytics allows you to create events and track them. It can be used to track clicks on links to external sites. For example, we need to track only the outbound links and email clicks, &hellip; <a href=\"https:\/\/polyetilen.lt\/en\/outbound-links-click-tracking-with-google-analytics\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"http:\/\/polyetilen.lt\/?p=305","footnotes":""},"categories":[8],"tags":[124,125,53,162],"class_list":["post-477","post","type-post","status-publish","format-standard","hentry","category-programavimas","tag-google-analytics","tag-iseinanti-nuoroda","tag-jquery","tag-sekimas","en-US"],"_links":{"self":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts\/477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/comments?post=477"}],"version-history":[{"count":1,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts\/477\/revisions"}],"predecessor-version":[{"id":479,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/posts\/477\/revisions\/479"}],"wp:attachment":[{"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/media?parent=477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/categories?post=477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/polyetilen.lt\/wp-json\/wp\/v2\/tags?post=477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}