From 317af4ef35604bccd9e9e6cd7313a025f883e288 Mon Sep 17 00:00:00 2001 From: Lauren Smith Date: Tue, 24 Sep 2013 01:22:36 -0500 Subject: [PATCH 1/4] better pageview tracking for themes using pjax --- plugin.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin.php b/plugin.php index 78b06df..a8b3961 100644 --- a/plugin.php +++ b/plugin.php @@ -20,6 +20,10 @@ function render() _gaq.push(['_trackPageview']); _gaq.push(['_anonymizeIP', {$anonymize}]); + $.pjax && $(window).on('k-pjax-end', function() { + _gaq.push(['_trackPageview']); + }); + (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; From 32e19357d6d43df319564fa960cf10649c9d4025 Mon Sep 17 00:00:00 2001 From: Lauren Smith Date: Tue, 24 Sep 2013 01:46:01 -0500 Subject: [PATCH 2/4] moving pjax inside an onready --- plugin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin.php b/plugin.php index a8b3961..61aa282 100644 --- a/plugin.php +++ b/plugin.php @@ -20,8 +20,10 @@ function render() _gaq.push(['_trackPageview']); _gaq.push(['_anonymizeIP', {$anonymize}]); - $.pjax && $(window).on('k-pjax-end', function() { - _gaq.push(['_trackPageview']); + $(function() { + $.pjax && $(window).on('k-pjax-end', function() { + _gaq.push(['_trackPageview']); + }); }); (function() { From 4c132b670d1ad20e0f71a6922de7f5346f81bd18 Mon Sep 17 00:00:00 2001 From: Lauren Smith Date: Tue, 24 Sep 2013 01:55:20 -0500 Subject: [PATCH 3/4] adding social tracking to koken share text links --- plugin.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin.php b/plugin.php index 61aa282..81a2869 100644 --- a/plugin.php +++ b/plugin.php @@ -24,6 +24,9 @@ function render() $.pjax && $(window).on('k-pjax-end', function() { _gaq.push(['_trackPageview']); }); + $('.social-links li,.kshare-items li').on('click', function() { + _gaq.push(['_trackSocial', $(this).find('a').text().toLowerCase()]); + }); }); (function() { From 99c413beecd5fe8638d4c26813d2984c91b917c7 Mon Sep 17 00:00:00 2001 From: Lauren Smith Date: Wed, 25 Sep 2013 11:31:28 -0500 Subject: [PATCH 4/4] ignore no-share links for social tracking --- plugin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin.php b/plugin.php index 81a2869..96c8634 100644 --- a/plugin.php +++ b/plugin.php @@ -24,7 +24,9 @@ function render() $.pjax && $(window).on('k-pjax-end', function() { _gaq.push(['_trackPageview']); }); - $('.social-links li,.kshare-items li').on('click', function() { + $('.social-links li,.kshare-items li').not(function() { + return $(this).find('a').hasClass('no-share'); + }).on('click', function() { _gaq.push(['_trackSocial', $(this).find('a').text().toLowerCase()]); }); });