Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google Analytics module


Guest

Recommended Posts

Having installed the GA eCommerce code on our site we were receiving no eCommerce data in GA. We decided to install this contribution to try and get some data but it hasn't worked accurately. After installing we began seeing transactions appear in the eCommerce section but they only account for about 10% of our orders. Anyone have an idea why only about 10% of the transactions are going to GA? It seems like the "goal conversions" is tracking our orders fairly accurately but we have no revenue data for most of them and eCommerce only has about 2 orders listed for every 20 goal conversions that go through. Any ideas why we would be getting so little data?

Link to comment
Share on other sites

  • Replies 389
  • Created
  • Last Reply

Top Posters In This Topic

Installed this and all works fine with IE and Firefox. The following with Chrome:

 

Works fine if the url is entered as follows: http://jeepswag.com/b/

 

Error message when the url is entered as: http://www.jeepswag.com/b/

 

Here's the error:

Fatal error: Call to a member function add_current_page() on a non-object in /home1/fouxfixc/public_html/b/includes/application_top.php on line 344

 

An additional question about Step 4: 4. in the ORIGINAL footer.php place the following script at the end of the file. I'm assuming that this gets placed before the last "?>" I've tried it both ways.

 

I have the same problem on Firefox. Page works only when entered without www, otherwise I get:

Fatal error: Call to a member function add_current_page() on a non-object in /var/www/vhosts/gu-gu.lt/httpdocs/catalog/includes/application_top.php on line 321

 

Please help us

Link to comment
Share on other sites

Having installed the GA eCommerce code on our site we were receiving no eCommerce data in GA. We decided to install this contribution to try and get some data but it hasn't worked accurately. After installing we began seeing transactions appear in the eCommerce section but they only account for about 10% of our orders. Anyone have an idea why only about 10% of the transactions are going to GA? It seems like the "goal conversions" is tracking our orders fairly accurately but we have no revenue data for most of them and eCommerce only has about 2 orders listed for every 20 goal conversions that go through. Any ideas why we would be getting so little data?

 

Our problem was special characters in product names, double quotes to be exact. We resolved the issue by escaping the characters in our PHP files. Good Luck!

Link to comment
Share on other sites

  • 5 weeks later...

Hi guys,

 

I've added this script. I'd previously been using Goal tracking in GA to monitor the performance of my sales funnel and decided recently to move to ecommerce tracking too. Here are some observations I wanted to share:

 

Using Goal Tracking

On my site, I track the checkout process from checkout_shipping.php onwards since this is the first part of the process that doesn't occur elsewhere (ie you might login to see order history so it is not definitely part of the funnel. Equally viewing cart could just be a comparison browser). On this I clock almost as many orders as I get in real life - maybe up to 5% less. However, once a customer comes to pay I offer multiple gateways:

 

- WorldPay

- PayPal

- DirecteBanking

- Cheque/Postal Order

 

VERY few of the customers using the first three options get tracked back to checkout_success.php, maybe as few as 2 in every 100. This may be explained that when the customer finishes paying via the 3rd party gateway they never return to my site and so the final page is never called.

 

Using eCommerce Tracking

I added the GA2.2 contribution. Testing it using cheque/postal order as a payment method was completely successful. Every last detail about the transaction was captured including the juicy bits like what was ordered and what value the order was, together where the visit originated from.

 

However with the other gateways I've had many orders and absolute nadda data! Is this because, as my previous goal tracking had alluded too, that customers rarely return to checkout_success.php?

 

A Possible Work Around?

I am seeing a lot of others on this thread saying something similar, especially the many stores using PayPal as their gateway. In fact I've spent sometime trying to find someone who has it accurately up and running for multiple 3rd party payment gateways and I'm yet to find one (if you're out there please holler!). I also see that most people are saying they get little data back, which again I'm assuming is backing up the data I've gathered over the last few years using Goal Tracking.

 

Here is a possible work around that I'm going to try myself. It will not provide 100% accurate stats, however it will likely provide far more stats than we're currently getting (next to nothing!) and should work for PayPal and other gateways.

 

My experience with Goal Tracking is that by the time someone has put in the effort to go through to checkout_confirmation.php they mostly go through with the order. In fact most of my drop offs at the point are fraud screens by RBS WorldPay declining cards and overall that's a small percentage. What I'm therefore going to do is move my ecommerce data capture from checkout_success.php to checkout_confirmation.php. On one hand I'll get a bit extra data because of the minority of transactions that go to the gateway and never complete. On the other hand that extra data will make up for the few GA always misses ;)

 

If I get time I'll pop back and update you as to how it went, I just thought I'd share the idea here since I'm sure many of you would rather have some actionable data than no actionable data. If you need help get in touch via my email form.

Link to comment
Share on other sites

OK, tried it. 24 hours on it's working perfect. I accept that I may get need to accept a minor variation in factual accuracy for a majority very useful data and at least it solves the problem that you can't follow a visitor off of your site and onto a 3rd party site and back again (if indeed they do come back).

 

To Clement, Thomas and Mathieu, a super big thanks for putting this code together - you guys rock! B)

Link to comment
Share on other sites

OK, tried it. 24 hours on it's working perfect. I accept that I may get need to accept a minor variation in factual accuracy for a majority very useful data and at least it solves the problem that you can't follow a visitor off of your site and onto a 3rd party site and back again (if indeed they do come back).

 

To Clement, Thomas and Mathieu, a super big thanks for putting this code together - you guys rock! B)

 

Hi Minxmoggy,

Thanks for your tip which I've used. At first I thought it worked perfectly with payments paid by Paypal. However, I just noticed that the Google Analytivs ecommerce tracking always misses one of the items in an order transaction.

For example:

-I put 3 products into my shopping cart, checkout and pay using Paypal.

-The order emails correctly show 3 products were ordered and paid for

- But Google Analytics/Ecommerce/Transactions only shows 2 of the products. The $ total for the transaction is correct, but the number of products is wrong.

 

If I do the same order but use check payment instead of Paypal, the transacction is recorded perfectly.

 

Did you (or anyone elese) have this problem?

 

Cheers

Link to comment
Share on other sites

Hello there,

 

Im trying to follow up with what Eric and Scott posted in regards to the new Asynchronous GA code.

 

Would like to know if its working properly for you guys

 

Eric, is the code you posted to use on checkout_success.php working?

 

Scott, it seems you were able to get multiple items on your orders to work, which was a concern Eric had. Can you confirm that?

 

How about the code that goes on footer.php. Should I get that from my GA profile under Setup/Advanced tab?

 

Now here is my concern/ question for both:

Google says this new code is faster to load than the old one and because of that it should be placed right before </head> tag.

Are we not taking advantage of this new feature by adding the code to the footer of the files? Is there a way to add it to the header?

 

Thank you guys!

 

Ricardo

 

Maybe one of you should make it a new Google Analytics addon?

Link to comment
Share on other sites

  • 2 months later...

Our problem was special characters in product names, double quotes to be exact. We resolved the issue by escaping the characters in our PHP files. Good Luck!

 

To elaborate further on the comment above - hopefully I am not speaking too soon - but for me, changing a section of /includes/modules/analytics/analytics.php

 

to

 

// Prepare the Analytics "Transaction line" string

$transaction_string = '"' . $order_id . '"," ' . $analytics_affiliation . '","' . $analytics_total . '","' . $analytics_tax . '","' . $analytics_shipping . '","' . $orders['customers_city'] . '","State","' . $orders['customers_country'] . '"';

// Get products info for Analytics "Item lines"

$item_string = '';
   $items_query = tep_db_query("select products_id, products_model, products_name, final_price, products_tax, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $order_id . "' order by products_name");
   while ($items = tep_db_fetch_array($items_query)) {
	$category_query = tep_db_query("select p2c.categories_id, cd.categories_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p2c.products_id = '" . $items['products_id'] . "' AND cd.categories_id = p2c.categories_id AND cd.language_id = '" . (int)$languages_id . "'");
	$category = tep_db_fetch_array($category_query);

$items_without_double_quotes = htmlentities($items['products_name'],ENT_QUOTES);


  $item_string .=  "pageTracker._addItem(\n\"" . $order_id . "\",\"" . $items['products_id'] . "\",\"" . $items_without_double_quotes . "\",\"" . $category['categories_name'] . "\",\"" . number_format(tep_add_tax($items['final_price'], $items['products_tax']), 2) . "\",\"" . $items['products_quantity'] . "\");\n";
   }

// ############## Google Analytics - end ###############

 

seems to have worked for me to track products that have double quotes in them (quite common in the UK where a double quote is often used in place of the word 'Inches').

Link to comment
Share on other sites

I am on the same boat as many who have posted in this thread. I followed the instructions to the T, turned on the ecommerce options in analytics and everything is installed correctly on the site yet Google is not collecting any data from my store. Why is no one answering the posts from people such as myself? Could someone who's figure this out please help us.

 

My Analytics Output

<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
 _uacct="UA-XXXXXX-1"
 urchinTracker();
</script>
<script type="text/javascript">
 var pageTracker = _gat._getTracker("UA-XXXXXX-1");

pageTracker._addTrans(
"22870"," ","8.10","0.19","4.92","Holyoke","Massachusetts","United States"
);

pageTracker._addItem(
"22870","10075","Calendario 2011 MANANTIAL DE VIDA  (Textos para cada día)","Agendas","2.99","1");
pageTracker._trackTrans();
</script>

Samuel Mateo, Jr.

osC 2.2 MS2

Installed Mods:

WYSIWYG HTMLArea 1.7 | Basic Template System 1.0 | osC-Affiliate | OSC-SupportTicket

Featured Products 1.3 | LoginBox 5.2 | LatestNews 1.1.3 | Extras for IE

Link to comment
Share on other sites

  • 1 month later...

I am sure you all solved your problems by now, and who knows, the most recent code probably works but if any of you are using the g analytics to track your sales in google analytics the code changes when you implement the newest asynchronous g_push type of tracking... Below is how I mangled it out. The key to this is the items in a transaction are repeated several times depending on the amount of different items in a transaction and each time through the item must be pushed onto the stack and then finally sealed so to speak with the end of the transaction marker... Enjoy!

 


   $transaction_string = '"' . $order_id . '"," ' . $analytics_affiliation . '","' . $analytics_total . '","' . $analytics_tax . '","' . $analytics_shipping . '","' . $orders['customers_city'] . '","' . $orders['customers_state'] . '","' . $orders['customers_country'] . '"';
?>
_gaq.push(['_setAccount', 'UA-226314-2']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
<?php $transaction_string ?>
]);
// Get products info for Analytics "Item lines"
<?php
   $item_string = '';
   $items_query = tep_db_query("select products_id, products_id, products_model, products_name, final_price, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $order_id . "' order by products_name");
   while ($items = tep_db_fetch_array($items_query)) {
       $category_query = tep_db_query("select p2c.categories_id, cd.categories_name from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p2c.products_id = '" . $items['products_id'] . "' AND cd.categories_id = p2c.categories_id AND cd.language_id = '" . (int)$languages_id . "'");
       $category = tep_db_fetch_array($category_query);


     $item_string = '"' . $order_id . '"," ' . $items['products__id'] . '"," ' . $items['products_model'] . '","' . $items['products_name'] . '","' . $category['categories_name'] . '","' . number_format($items['final_price'], 2, '.', '') . '","' . $items['products_quantity'] . '"';
?>
   _gaq.push(['_addItem',
    <?php echo $item_string; ?>
    ]);
<?php
   }
?>
_gaq.push(['_trackTrans']);

// ############## Google Analytics - end ###############

 

Hi Scott,

 

I have tried installing this piece of code without success - prior to adding this code, I could see ecommerce tracking in GA but only the last product in a multi product order was showing. With this code I am no longer seeing ecommerce at all. Are you able to paste your complete analytics.php script and did you make any other changes eg. to checkout_success.php to make multiple product work?

Anyone else had success with getting multiple product orders to record properly??

Thankyou,

Sarah

Edited by sbetto
Link to comment
Share on other sites

  • 2 months later...

Paypal standard uses its own checkout_success.php therefore does not collect the transaction information provided by the chekcout_success.php modified.

 

The checkou_success.php of paypal standard is very different from general checkout_success.php and can not be changed by following the instructions of the contribution.

 

Does anyone know any solution?

Thank you very much, greetings.

Edited by Hionir
Link to comment
Share on other sites

hi there,

 

New member..

 

Could any one help me on this quick one.. I just want to add analytics to the index page, looking back over the thread someone mentions simply inserting the google script into </head> section, I cant find this and I noticed the post is from 2005.. can anyone point me in the right direction.. I am not looking for analytics tracking through to transactions

 

thanks

Shane

Link to comment
Share on other sites

  • 7 months later...
  • 2 months later...

I am not sure if anyone can help me, but here is the situation:

 

Google Analytics is working perfect tracking transactions except when the following combination is used:

 

When a person checks out with paypal and uses fedex as the shipping provider, it does not record the transaction to GA.

 

If the person checks out with paypal and uses usps as the shipping provider, it works great.

 

Also, if a person uses a credit card and fedex as the shipping provider, it works great.

 

Does anyone have any idea why this might be with not recording the transaction with paypal and fedex combo?

 

Thanks

 

Evan

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...