You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Is there a patch available to support Google Universal Analytics?
I am in the process of setting up a new e-commerce website with clickcartpro 8 and Google Universal Analytics.
Google Universal Analytics is extremely important to our operaion. All of the new websites we set up are using Universal Analytics ... and as soon as Google activates the migration process we will be upgrading all of our old websites to Universal Analytics...
I found the section in jslib.php that has the analytics code ... and I am thinking about trying to patch it myself, but it seems to me that everybody is going to need Universal Analytics functionality...
So if you could please point me to the patch for this, I would greatly appreciate it.
Offline
SirLogic wrote:
Is there a patch available to support Google Universal Analytics?
I am in the process of setting up a new e-commerce website with clickcartpro 8 and Google Universal Analytics.
Google Universal Analytics is extremely important to our operaion. All of the new websites we set up are using Universal Analytics ... and as soon as Google activates the migration process we will be upgrading all of our old websites to Universal Analytics...
I found the section in jslib.php that has the analytics code ... and I am thinking about trying to patch it myself, but it seems to me that everybody is going to need Universal Analytics functionality...
So if you could please point me to the patch for this, I would greatly appreciate it.
I don't believe there's support for this yet. I would either hang tight, or update the jslib.php file.
Offline
I've done some reading on Google Universal Analytics, but can't determine if it's supposed to replace the base analytics or work in conjunction with it. It looks to me like a replacement. Thoughts? jj1987 is right in that the mods would be limited to jslib.php.
Offline
It is a replacement, at some point the old analytics will no longer be available and at another point all old analytics accounts that haven't already been migrated will be automatically migrated...
And, it is an improvement over the old analytics...
Offline
If anybody wants to jump in and provide a patch, feel free....
Before then, how do I get the analytics code to insert into the body instead of the header? Google Universal Analytics wants to be in the body directly after the body tag, not in the header...
Offline
SirLogic wrote:
If anybody wants to jump in and provide a patch, feel free....
Before then, how do I get the analytics code to insert into the body instead of the header? Google Universal Analytics wants to be in the body directly after the body tag, not in the header...
I would just remove the google analytics code from your settings, then update skin.php and place the code directly in there. It wouldn't be the correct way to do it for the default CCP install, but I think this would be easiest for your needs if it has to be in the body.
Offline
jj1987 wrote:
I would just remove the google analytics code from your settings, then update skin.php and place the code directly in there. It wouldn't be the correct way to do it for the default CCP install, but I think this would be easiest for your needs if it has to be in the body.
You are right, that isn't the correct way of doing it, and it is not a good long term solution, but it does solve my immediate need :-)
I do want to use the e-commerce recording capabilities of Universal Analytics, but my site isn't quite at that point just yet, so your solution will work quite well.
Thanks
Offline
Hi,
I know this topic is kinda old but I just got to the point of really needing to change to the Universal Analytics. Has anyone done anything more with this other than the above listed or is there a patch?
Thanks
Offline
I've just been looking at this and is what Google says about it.
I'd like to be able to use things like In-Page Analytics, but that's *way* too complicated for me to start playing around with, and I'm sure many other v8 users would like to be able to do this too, so it really does need a patch.
Offline
It's easy. In the file {private}/core/CORE/includes/jslib.php, replace the entire section under the comment:
// +-- // | Handle Google Analytics (FrontEnd Only). // +--
With:
$gaid = $this->globals('core_settings.core.seo_googleacct'); $order = $this->globals('ecom.order_analytics'); if ((!(empty($gaid))) && ($interface == 'FrontEnd') && (empty($remoteskinexporter_active))) { $requesturi = $this->globals('core.requesturi'); $requesturi = preg_replace('/^' . preg_quote($this->globals('core.url_nonssl'),'/') . '/','',$requesturi); $requesturi = preg_replace('/^' . preg_quote($this->globals('core.url_ssl'),'/') . '/','',$requesturi); $requesturi = preg_replace('/\&\;/','&',$requesturi); print '<script type="text/javascript">' . $eol; print '//<![CDATA['. $eol; print '(function(i,s,o,g,r,a,m){i[\'GoogleAnalyticsObject\']=r;i[r]=i[r]||function(){' . $eol; print '(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),' . $eol; print 'm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)' . $eol; print '})(window,document,\'script\',\'//www.google-analytics.com/analytics.js\',\'ga\');' . $eol; print 'ga(\'create\', \'' . $this->xhtml_encode($gaid) . '\', \'auto\');' . $eol; print 'ga(\'require\', \'displayfeatures\');' . $eol; print 'ga(\'send\', \'pageview\', \'' . $requesturi . '\');' . $eol; // +-- // | Write out order information, if applicable. // +-- if ((!(empty($order['order']))) && (!(empty($order['items'])))) { print 'ga(\'require\', \'ecommerce\', \'ecommerce.js\');'; $total_tax = $order['order']['taxsptotal'] + $order['order']['taxctotal'] - $order['order']['taxcreftotal']; if ($total_tax < 0) {$total_tax = '0.00';} print 'ga(\'ecommerce:addTransaction\', {' . $eol; print '\'id\': \'' . $order['order']['id'] . '\',' . $eol; print '\'affiliation\': \'Web Store\',' . $eol; print '\'revenue\': \'' . $order['order']['ordertotal'] . '\',' . $eol; print '\'shipping\': \'' . $order['order']['shiptotal'] . '\',' . $eol; print '\'tax\': \'' . $total_tax . '\'' . $eol; print '});' . $eol; foreach ($order['items'] as $num => $data) { $itemprice = $data['ordertotal'] / $data['itemquan']; $itemprice = sprintf("%.2f",round($itemprice,2)); print 'ga(\'ecommerce:addItem\', {' . $eol; print '\'id\': \'' . $data['orderid'] . '\',' . $eol; print '\'name\': \'' . $data['itemname'] . '\',' . $eol; print '\'sku\': \'' . $data['itemnum'] . '\',' . $eol; print '\'price\': \'' . $itemprice . '\',' . $eol; print '\'quantity\': \'' . $data['itemquan'] . '\'' . $eol; print '});' . $eol; } // End of foreach statement. print 'ga(\'ecommerce:send\');' . $eol; } // End of if statement. print '//]]>'. $eol; print '</script>' . $eol; } // End of foreach statement.
Offline
Thanks Nick. Been meaning to ask about that for a while.
Just to clarify, we replace all the code between
// +-- // | Handle Google Analytics (FrontEnd Only). // +--
and
// +-- // | Handle Google Analytics Adwords Conversions (FrontEnd Only). // +--
Last edited by sdn (05-28-2014 09:13:47)
Offline
Nick
Is there a glitch is this code??
Google Analytics is showing all of my sales being referred from either Sagepay or Paypal, not adwords or organic as it did previously
Offline
It seems you need to manually exclude third party referrals such as PayPal.com
https://support.google.com/analytics/an … 5830?hl=en
Offline
It appears to have worked.
Only been going for an hour and I have had one sale showing as adwords referral and two as paypal referral.
I expect the sessions for the 2 paypal referrals were created before I excluded the url's.
WIll report back tomorrow.
Offline
After excluding the payment urls, for me that was paypal.com and live.sagepay.com, all transactions were shown in the correct referrer column, i.e. paid, organic, direct.
The only issue I have is analytics is showing more transcations than have actually occured.
This morning they are showing 2 extra transcations via Direct/None referrer.
I don't know if these transcations are failed/aborted sales that have been passed through to analytics.
Once I have more data to look at I will report back.
Offline
Google ecommerce tracking is working correctly after manually excluding the payment URL's
Offline
I've included the above code on my site, however when I try going to Google Analytics / Behaviour / In Page Analytics I don't get any bubbles or information on where people have clicked.
I'm registered for Universal Analytics and I've tried using In Page Analytics in full screen etc, but that's not helped.
Is there a problem with the code?
Offline
I am seeing the same problem. Google reports:
We've identified problems in your setup. These may cause problems loading In-Page Analytics.
Your site doesn't load ga.js from Google. If you host the Google tracking code on your own servers, it isn't updated automatically and can miss important changes.
We didn't find a tracking snippet on your site. In-Page Analytics cannot load. Please make sure you have tracking installed correctly. If your snippet is included in a separate JavaScript file, you'll have to manually check it is being loaded correctly.
Offline
Have you got in page analytics turned on??
I don't know what it is, but i notice there is a setting in google analytics to turn it on.
Admin > Property Setting >
Offline
and it looks like you need to code more than the standard set up:
https://support.google.com/analytics/an … ;utm_id=ad
Offline
zanart wrote:
Have you got in page analytics turned on??
I don't know what it is, but i notice there is a setting in google analytics to turn it on.
Admin > Property Setting >
Yes, I have those switched on, but I don't know about implementing the extra code in your link above or how to do this...
Offline