Kryptronic Software Support Forum

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.

#1 07-28-2013 11:54:16

SirLogic
Member
Registered: 07-28-2013
Posts: 10

Google Universal Analytics

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

 

#2 07-29-2013 08:46:50

jj1987
Member
From: Orlando, FL
Registered: 07-14-2008
Posts: 502
Website

Re: Google Universal Analytics

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.



-James Garrett

Offline

 

#3 07-29-2013 09:47:27

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Google Universal Analytics

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.


Nick Hendler

Offline

 

#4 07-29-2013 10:30:07

SirLogic
Member
Registered: 07-28-2013
Posts: 10

Re: Google Universal Analytics

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

 

#5 07-29-2013 10:36:16

SirLogic
Member
Registered: 07-28-2013
Posts: 10

Re: Google Universal Analytics

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

 

#6 07-29-2013 10:44:22

jj1987
Member
From: Orlando, FL
Registered: 07-14-2008
Posts: 502
Website

Re: Google Universal Analytics

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.



-James Garrett

Offline

 

#7 07-29-2013 16:12:33

SirLogic
Member
Registered: 07-28-2013
Posts: 10

Re: Google Universal Analytics

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

 

#8 05-03-2014 22:01:23

juanstg
Member
From: Evansville, IN
Registered: 02-26-2010
Posts: 78

Re: Google Universal Analytics

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

 

#9 05-25-2014 18:11:15

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Google Universal Analytics

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

 

#10 05-27-2014 09:27:41

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Google Universal Analytics

It's easy.  In the file {private}/core/CORE/includes/jslib.php, replace the entire section under the comment:

Code:

// +--
// | Handle Google Analytics (FrontEnd Only).
// +--

With:

Code:

$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('/\&amp\;/','&',$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.

Nick Hendler

Offline

 

#11 05-28-2014 05:12:21

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Google Universal Analytics

webmaster wrote:

It's easy.

For certain values of "easy"...! ;-)

Thanks for that.

Offline

 

#12 05-28-2014 05:56:29

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: Google Universal Analytics

Thanks Nick. Been meaning to ask about that for a while.

Just to clarify, we replace all the code between

Code:

// +--
// | Handle Google Analytics (FrontEnd Only).
// +--

and

Code:

// +--
// | Handle Google Analytics Adwords Conversions (FrontEnd Only).
// +--

Last edited by sdn (05-28-2014 09:13:47)


Simon

Offline

 

#13 06-06-2014 14:31:33

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

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


Rob

Offline

 

#14 06-06-2014 15:44:15

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

It seems you need to manually exclude third party referrals such as PayPal.com
https://support.google.com/analytics/an … 5830?hl=en


Rob

Offline

 

#15 06-06-2014 16:31:12

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Google Universal Analytics

Interesting.  I had not had that reported.  Are you able to exclude those referrals?  Ie, did that work?


Nick Hendler

Offline

 

#16 06-06-2014 16:36:57

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

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.


Rob

Offline

 

#17 06-07-2014 04:35:54

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

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.


Rob

Offline

 

#18 06-07-2014 08:34:12

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

Google ecommerce tracking is working correctly after manually excluding the payment URL's


Rob

Offline

 

#19 06-11-2014 05:32:04

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Google Universal Analytics

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

 

#20 06-11-2014 09:40:10

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Google Universal Analytics

Others are using the code above without issues.  I think Analytics takes a while to kick in and start getting you valid data.  Is any tracking occurring?


Nick Hendler

Offline

 

#21 06-11-2014 10:05:16

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: Google Universal Analytics

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.


Simon

Offline

 

#22 06-11-2014 11:03:11

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

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 >


Rob

Offline

 

#23 06-11-2014 11:15:17

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1706

Re: Google Universal Analytics

and it looks like you need to code more than the standard set up:
https://support.google.com/analytics/an … ;utm_id=ad


Rob

Offline

 

#24 06-12-2014 06:53:34

Graham
Member
Registered: 09-30-2004
Posts: 981
Website

Re: Google Universal Analytics

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

 

#25 06-12-2014 10:03:12

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Google Universal Analytics

I'm not sure what you guys are trying to do, but the drop in code I provided works fine.


Nick Hendler

Offline

 

Board footer