Post by Xsecrets » Tue Feb 01, 2011 6:21 am

jcgadgets wrote:
Xsecrets wrote:
Brocberry wrote:For those of us who send our customers to off-site to make payment, we need to give the gateway a page to send the customer back to once the transaction is complete... and then we tell GA which that page is I think. What page can we send the customer back to in OC for GA to recognise a complete transaction?
index.php?route=common/success most of the gateways will set this for you automatically.
Do you know if the PayPal Standard module has this set automatically?


Thank you,
Jared
yes it does.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Xsecrets » Tue Feb 01, 2011 6:25 am

jcgadgets wrote:I also wanted to see if what we have concluded here coincides with what others have come up in this thread?:

http://forum.opencart.com/viewtopic.php ... ilit=ecomm

Or if perhaps we can get some ideas from there. Which modification method is "better"?


Thank you,
Jared
I think either one will work if you can figure them out since both seem to be very disjointed. Honestly google analytics with ecom support really should be put in the core. I mean seriously this is a shopping cart if you are going to bother providing analytics support in the core why wouldn't you add the ecommerce part since that should pretty much always be the main purpose of an opencart install.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by jcgadgets » Tue Feb 01, 2011 6:37 am

Xsecrets wrote: ...Honestly google analytics with ecom support really should be put in the core. I mean seriously this is a shopping cart if you are going to bother providing analytics support in the core why wouldn't you add the ecommerce part since that should pretty much always be the main purpose of an opencart install.
- Couldn't agree more! Couldn't have said it better. Very odd really, why it's not in the core. I wonder if it's planned for 1.5.0...

I guess I will just stick to this one, as this is the one I've already implemented. I'll watch and see if the next sale is captured (my site has only been live for just under a month, so the sales are coming in slowly as per nearly non-existent search rankings at the moment).

Thanks for the PayPal answer too :)


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by philbydevil » Wed Feb 02, 2011 7:50 pm

I'm trying to write a vQmod for this but can't seem to get it working. Has anyone had any luck implementing these code changes?

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by justinv » Thu Feb 03, 2011 11:13 am

I have edited my original post - it should work now. There were a couple of steps that were missing, follow steps 5 and 6 to provide access to order details on the checkout page.

Thanks
Justin

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm

Post by philbydevil » Thu Feb 03, 2011 1:09 pm

Awesome justinv! That seems to be working now. Will get the vQmod cleaned up (and add some instructions) and upload it shortly.

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by philbydevil » Thu Feb 03, 2011 4:24 pm

vQmod uploaded.

Be sure to read the installation instructions (install.txt) prior to use or it won't work.

Thanks for the code justinv ;)

Attachments


I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by philbydevil » Thu Feb 03, 2011 4:53 pm

According to Google, it seems that all products need SKUs to be tracked correctly. Not sure if this is correct or not.

EDIT: the SKU seems to be the product_id (from the DB) so they don't need to be set manually in Admin.

One thing that I am noticing with my test transactions is that in GA, under E-Commerce, "Categories" is reporting the "Product Categories" as the model number of product/s, not the actual category.

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by jcgadgets » Thu Mar 03, 2011 5:31 am

Hi all,

I just wanted to report that, unfortunately, this does not seem to be working for me :( I'm quite certain I implemented everything correctly, as I asked questions on the things I was not 100% certain about. I got a sale a few days ago, and just checked Google Analytics. Unfortunately, it was not reported there.

I'm going to give that other thread I mentioned a shot and see what happens.


Thank you!
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by justinv » Fri Mar 04, 2011 6:18 am

Common problem is javascript errors on your page - if you have a js error, your analytics will not fire.

Create a free product and do some test purchases on it on your site, you should be able to see those come through or notice if there are js errors on the page using web developer toolbar in FF or the little icon bottom left in IE.

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm

Post by jcgadgets » Fri Mar 04, 2011 3:30 pm

Hey thanks!

I will try that out!


Thank you,
Jared

Active Member

Posts

Joined
Sun Oct 31, 2010 4:49 pm

Post by Brocberry » Sun Mar 20, 2011 1:10 am

Xsecrets wrote:
Brocberry wrote:For those of us who send our customers off-site to make payment, we need to give the gateway a page to send the customer back to once the transaction is complete... and then we tell GA which that page is I think. What page can we send the customer back to in OC for GA to recognise a complete transaction?
index.php?route=common/success most of the gateways will set this for you automatically.
Thanks but I'm not sure I understand... that url, is that the real url for opencart and as it happens the same url for most other carts?

New member

Posts

Joined
Tue Jun 01, 2010 3:31 am
Location - England

Post by traceofwind » Wed May 04, 2011 7:29 pm

Hi Justinv, everyone

Two questions, if I may:

(1) Does this require the GA module to be installed (if GA code has been added to header.tpl manually)?
(2) Does the async GA snippet go before or after "<?php echo $google_analytics; ?>"?

NB: I have been tracking OpenCart via GA for some time (using the include method in the body tag) and have since switched to the async GA method, placing the code (below) in the header.tpl. I have never installed the GA module supplied with OpenCart's, however -I added the code myself. I was wondering then, if this would work for me or if someone could explain what the '<?php echo $google_analytics; ?>' code does?

Excerpt from my header.tpl (account number removed):

Code: Select all

<script type="text/javascript">
   var _gaq = _gaq || [];
   _gaq.push(['_setAccount', 'UA-xxxxxxx-xx']);
   _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';
         var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
   })();
</script>
<?php echo $google_analytics; ?>
</head>
Thanks in advance, all the best!

Gary

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by justinv » Thu May 05, 2011 3:56 pm

Hi Gary,

The GA module gives you a text area in your admin where you can put your GA code from Google.

The echo $google_analytics; code puts whatever you put in admin onto your page. So putting your async GA code directly in the header.tpl is the same as enabling the GA module and putting the async GA code into your admin text area. Apart from by default, the echo $google_analytics; is in the footer, so on a default install it would go before the closing </body> tag.

In summary you should do one or the other - either enable the GA module, or paste your code directly into your header. Enabling the module would be preferable, as it's better to play by the rules.

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm

Post by traceofwind » Fri May 13, 2011 11:02 pm

Hi,

I can't quite get this working. I have updated the relevant pages (1) footer.php, (2) header.php, (3) success.php, (4) order.php, (5) footer.tpl, (6) header.tpl and (7) success.tpl -but to no avail. Specifically, the Google Ecommerce tracking script does not appear in the source code upon Order Confirmation (success) page.

I am testing my site using 'Cash on delivery' payment method -that shouldn't cause any problems -should it?

Additionally, I would rather not use the vqMod as my files are already modified. At this point I'd appreciate any advice -I can't see what is wrong. My only clue is that Dreamweaver tells me there is a problem with the code syntax on the following lines:

Code: Select all

'<?php echo $orderDetails['order_id']; ?>',
...
'<?php echo $orderDetails['total']; ?>',
Any ideas?

Best regards,
Gary

PS,
Justinv -you may want to add to the first post, that the success.tpl code should be added before the '<?php echo $footer; ?>' code. Currently it doesn't specify where to insert the code.

EDIT-
Justin, your code for success.tpl, may I ask why you used this Asynchronous code in the body and not the header, or why did you not use the 'Traditional' code as per Google's own Ecommerce example code? It is my understanding that Async code (that you have kindly provided) is intended for the <head></head> tags -not to be included in the <body></body> tags -as the Traditional code is.

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by stonehinged » Fri May 27, 2011 9:07 pm

Shouldn't your code closing tag:

Code: Select all

<?php foreach($orderProducts as $product) { ?>
      _gaq.push(['_addItem',
          "<?php echo $product['order_id']; ?>",
          "<?php echo $product['product_id']; ?>",
          <?php echo json_encode($product['name']); ?>,
          "<?php echo $product['model']; ?>",
          "<?php echo $product['price']+($product['price']*$product['tax']/100); ?>",
          "<?php echo $product['quantity']; ?>"
       ]);
   <? } ?>
be instead

Code: Select all

<?php } ?>
I'm also not seeing the ecom tracking code on my success page in the page source... almost like it didn't recognize the <?php if(isset($orderDetails) && isset($orderProducts)) { ?> statement, but I have confirmed the appropriate code to be in my success.php file before $this->cart->clear();

Please advise.

STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/


User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:10 am
Location - US

Post by traceofwind » Fri May 27, 2011 11:01 pm

Similar to Stonehinged,

I am still experiencing the same issues: no e-commerce tracking code on the success page nor results in Google Analytics.

Also interesting what Stonehinged pointed regarding the closing tag, can anyone else confirm?

All the best

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am

Post by stonehinged » Sat May 28, 2011 12:31 am

Unfortunately, it didn't help with the end result and achieving the data expected. I can't see the Google Ecom tracking at all in page source, but even stranger... no apparent errors in OC admin. It's like the "if" statement is coming back "null" so no code shows up. I may try an "else" statement to see if that content will display for me. If that does, that should fairly well conclude there's an issue with the "if" statement or code it's referring to on the success.php file.

STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/


User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:10 am
Location - US

Post by stonehinged » Sat May 28, 2011 12:36 am

So I can confirm with an "else" statement, the "else" condition displays... maybe this helps us debug?

STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/


User avatar
Active Member

Posts

Joined
Wed Aug 18, 2010 9:10 am
Location - US

Post by traceofwind » Sat May 28, 2011 12:44 am

Hi Stonehinged,

Nice idea, I had suspected the IF statement but hadn't thought of adding an ELSE statement to help us debug, kudos! I will try some debugging myself on this tangent and report back.

PS, did you try the VQ Mod or did you install manually?

New member

Posts

Joined
Fri Jul 02, 2010 6:37 am
Who is online

Users browsing this forum: No registered users and 6 guests