From 1a91501e7b86ebf1520c3a94a9e38ac389d7f82e Mon Sep 17 00:00:00 2001 From: Georgi Georgiev Date: Thu, 6 Nov 2014 19:21:09 +0200 Subject: [PATCH] Added option to enable Enhanced Link Attribution --- EGoogleAnalytics.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/EGoogleAnalytics.php b/EGoogleAnalytics.php index ca6944e..b9350e8 100644 --- a/EGoogleAnalytics.php +++ b/EGoogleAnalytics.php @@ -90,6 +90,12 @@ class EGoogleAnalytics extends CApplicationComponent * @var boolean the title detection flag. */ public $detectTitle = true; + + /** + * + * @var boolean - Enables Enhanced Link Attribution + */ + public $enableInpageLinkid = false; /** * @var string the new sample set size for Site Speed data collection. By default, Google Analytics @@ -166,6 +172,10 @@ public function run() $trackTrans = "_gaq.push(['_trackTrans']);\n"; $script = "var _gaq = _gaq || [];\n"; + if ($this->enableInpageLinkid){ + $script .= "var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';\n"; + $script .= "_gaq.push(['_require', 'inpage_linkid', pluginUrl]);\n"; + } $script .= "_gaq.push(['_setAccount', '{$this->account}']);\n"; $script .= $ignoredOrganics . $ignoredRefs . $organics; $script .= "_gaq.push(['_setDomainName', '{$this->domainName}']);\n";