Page 5 of 7

Re: Google Analytics Ecommerce Tracking

Posted: Wed May 09, 2012 7:46 am
by stonehinged
I can confirm addOrder($data) is in my version, which is 1.5.2.1.

I've looked at my Google account in analytics and no conversions reported for the 5 or 6 test orders I placed. Wouldn't have anything to do with C.O.D. paymethod would it? I did not try a PayPal order but will. I'll try to see if I can see if I can spot anything in Firebug.

Any other possible ideas?

Re: Google Analytics Ecommerce Tracking

Posted: Wed May 09, 2012 8:13 am
by moneycarlo
payment method shouldn't matter, i dont think as long as your getting to the success page. I just tried a COD and it worked for me.
are you using default template, or have edited the xml for your template path? Have google analytics enabled in your admin panel? have "E-Commerce Tracking" turned on in your Google Analytics account?

Otherwise in chrome or ie you should be able to open the dev tools and review what the javascript is sending.

Re: Google Analytics Ecommerce Tracking

Posted: Wed May 09, 2012 9:38 am
by stonehinged
Yeah, the first thing I did was to see if I could see the variables in Developer Tools (and I can). But still nothing in my Google Analytics account. It's now been long enough to register.

Using default template, no edits to the path. GA enabled in admin and E-Com tracking turned on in the GA account.

Odd thing is that when I tested a week or two back w/o shipping and tax variables I was seeing variables in page source and seeing conversions in GA.

Sure wish I could get this last bit figured out! Thanks for your replies and tries moneycarlo! I trust you've actually seen conversions in your GA account with this vQmod?

Re: Google Analytics Ecommerce Tracking

Posted: Wed May 09, 2012 10:50 pm
by stonehinged
OK, I think I may have narrowed this down to an issue with coupons. I finally saw one order come through analytics last night and it might have been the ONLY order I did test w/o a coupon. Has anyone else seen issues with coupon entries causing issues with reporting in Google Analytics?

Moneycarlo, if you haven't, can you try your vQmod and order with a coupon and confirm the analytics reports the conversion?

Re: Google Analytics Ecommerce Tracking

Posted: Wed May 09, 2012 11:27 pm
by moneycarlo
i just tried a coupon and it worked fine. I'll try a few more things today and see if i notice anything. I was also told we're not seeing it in the source because somehow it's getting appended to the .js itself. Which doesn't help me much since im not really a programmer haha
I use chrome, and have dev tools open and on the success page, i go to scripts and select the "index.php?route=checkout/success" script from the drop down and i can still see all my tags and they show up in my GA.

Re: Google Analytics Ecommerce Tracking

Posted: Thu May 10, 2012 12:15 am
by stonehinged
Thanks moneycarlo, I have verified the variables in Developer Tools and in Firebug, so I'm less concerned, especially since I got one conversion to register last night perfectly. But I've tested another w/o coupon code today and it's not in analytics yet (and it's been over an hour). It's very strange. I am testing on my localhost, but that's never seemed to make a difference before. I want to see these conversions come in consistently of course.

Let me know what you find, I'll do the same. Feel free to PM me.

Steve

Re: Google Analytics Ecommerce Tracking

Posted: Wed Jun 27, 2012 1:09 am
by moneycarlo
Sorry, was out of country for a month.
to recap:
I updated to 1.5.2.2(r990) and added the missing fields like tax, shipping info etc.
I also changed the way the product price was being calculated. The numbers never came out correctly for my use and just seemed odd.
The old calculation was (i suspect they meant the price was supposed to be multiplied by the tax rate and not the actual tax?):
$product['price']+($product['price']*$product['tax']/100)

I changed it to:
$product['price']+$product['tax'];

Previously, it was giving errors if no tax or shipping was used. I have corrected that so it should work fine for all the scenarios i could think of.

Remember, i'm basically a glorified hack so i may not be too helpful in php/mysql troubleshooting but tried my best to make it work for everyone.
Good luck!

Re: Google Analytics Ecommerce Tracking

Posted: Wed Jun 27, 2012 6:57 am
by designbuyers
How it possible to test it with opencart ?

Should I make fake order to see if it can track conversions or not ?

Re: Google Analytics Ecommerce Tracking

Posted: Fri Jul 13, 2012 4:21 am
by sjiitb
Hi
I want to thank justinv from the bottom of my heart for the awesome instructions!

Just a small doubt. To track normal page visits, I should include the standard google analytics code in the header right?
Won't this be double-counting the order success page?

Re: Google Analytics Ecommerce Tracking

Posted: Fri Jul 13, 2012 5:06 am
by designbuyers
moneycarlo wrote:Sorry, was out of country for a month.
to recap:
I updated to 1.5.2.2(r990) and added the missing fields like tax, shipping info etc.
I also changed the way the product price was being calculated. The numbers never came out correctly for my use and just seemed odd.
The old calculation was (i suspect they meant the price was supposed to be multiplied by the tax rate and not the actual tax?):
$product['price']+($product['price']*$product['tax']/100)

I changed it to:
$product['price']+$product['tax'];

Previously, it was giving errors if no tax or shipping was used. I have corrected that so it should work fine for all the scenarios i could think of.

Remember, i'm basically a glorified hack so i may not be too helpful in php/mysql troubleshooting but tried my best to make it work for everyone.
Good luck!
Why not submit it on extensions directory.

Re: Google Analytics Ecommerce Tracking

Posted: Tue Jul 17, 2012 7:14 am
by JhauraW
UPDATE July 20, 2012: Fixed a bug in Product Name for some users.

I've made some fixes and improvements. This version confirmed working on 1.5.2.1

Mainly,

* Added $orderDetails['store_name'] for Affiliation instead of hard-coded

* I don't use product price + tax as Price in addItem because tax is shown in order total in addTrans

* $product['model'] for SKU instead of product database row id

* Hard coded 'Products' for category instead of $product['model'] which has nothing to do with category

Re: Google Analytics Ecommerce Tracking

Posted: Tue Jul 17, 2012 7:25 am
by 3antz
Hi JhauraW, do you know if this would work with 1.5.3.1 ? Thanks in advance

Re: Google Analytics Ecommerce Tracking

Posted: Sat Jul 21, 2012 3:19 am
by JhauraW
Sorry haven't upgraded yet.

Re: Google Analytics Ecommerce Tracking

Posted: Fri Aug 10, 2012 7:01 am
by designbuyers
JhauraW wrote:Sorry haven't upgraded yet.
You didn't upgrade your opencart to latest version ?

Re: Google Analytics Ecommerce Tracking

Posted: Tue Aug 28, 2012 11:52 pm
by storm-cloud
Just wondering if anyone has worked out how to include the product category variable?

I assume an extra database query needs to be included but I can't quite work this out...

Edit: JhauraW, I have just noticed that you removed the Google Analytics Account ID from the script. This is actually required for the tracking to work correctly.

Re: Google Analytics Ecommerce Tracking

Posted: Thu Oct 11, 2012 2:34 am
by promofire
Does this work with 1.5.4.1?

Re: Google Analytics Ecommerce Tracking

Posted: Sun Oct 14, 2012 3:37 am
by 1nkling
promofire wrote:Does this work with 1.5.4.1?
It would seem not.

With this vqmod engaged my customers are getting the error:

Fatal error: Call to undefined method ModelCheckoutOrder::getOrderProducts() in /home/mywebspace/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_success.php on line 13

Seems the vqmod doesn't work with the latest version.. :'(

Tis a shame as I liked having my ecommerce tracking on analytics.

Re: Google Analytics Ecommerce Tracking

Posted: Sun Oct 14, 2012 2:53 pm
by philbydevil
There's only a small change required... If out can't work it out I'll have a look at my xml file... probably won't be able to do it for a couple of days though.

Re: Google Analytics Ecommerce Tracking

Posted: Mon Oct 15, 2012 7:43 am
by 1nkling
philbydevil wrote:There's only a small change required... If out can't work it out I'll have a look at my xml file... probably won't be able to do it for a couple of days though.
Would be great if you can solve it. Thankyou! :)

Re: Google Analytics Ecommerce Tracking

Posted: Mon Oct 15, 2012 4:18 pm
by philbydevil
Try this xml for 1.5.4.1: You may have to change this line of code:

Code: Select all

<file name="catalog/view/theme/*/template/common/success.tpl">
The * may need to be changed to your theme name, but I think that * means ALL themes....