Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Google Analytics module


Guest

Recommended Posts

I have installed this contribution and it works great.

 

Where do I add the code to get it to work with the paypal ipn module?

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

Do I added in the paypal_ipn.php file? If so, Where in the file do I add it?

 

Thanks,

 

Monito

Link to comment
Share on other sites

  • Replies 389
  • Created
  • Last Reply

Top Posters In This Topic

I've read this thread from start to finish & can't decide what to do. I put the analytics script into my footer.php module & the code shows up nicely before the /BODY & /HTML tags at the end of each & every page. I don't know if this will actually work, I've been waiting for Google to update for a long time now. However the script shows up on every page possible that includes footer.php (which is to say ALL of them!) so I'm doing something right.

 

BUT...... how does the analytics module make this better? What does it give me over & above what I have now? (assuming it actually works!)

 

Tnx.

 

Mike

Edited by mikey boy
Link to comment
Share on other sites

  • 2 weeks later...

Help! I have installed the latest contribution (Stock OSC HTTP/HTTPS detection) but I am getting no results inside my analytics account. I have been trouble shooting for the past week, exhausted this thread and the 'help' that Google offers.

 

The code appears to be displaying perfectly:

<head>

<!-- Google Analytics Code -->

<script src="http://www.google-analytics.com/urchin.js">

<script type="text/javascript">

_uacct = "UA-1892638-1";

urchinTracker();

</script>

<!-- End Google Analytics Code -->

 

And for secure pages:

<head>

<!-- Google Analytics Code -->

<script src=" https://ssl.google-analytics.com/urchin.js">

<script type="text/javascript">

_uacct = "UA-1892638-1";

urchinTracker();

</script>

<!-- End Google Analytics Code -->

 

I have no idea how to proceed with trouble-shooting beyond these forums and Google's help pages. Has anyone had a similar experience? Any advice?

 

Totally data-less...

Kelani

Link to comment
Share on other sites

  • 1 month later...

i have the same "problem" redrum has (had? :)).

 

it looks like both of us have final_price in our orders_products table with no tax included.

 

so, i (we?) can't pick up some other value from db to have detailed prices for single products.

 

two possible solutions:

1) keep things as they are. we'll see prices without tax included in e-commerce reports in google analytics

2) try to add tax to product price 'on the fly' in includes/modules/analytics/analytics.php before we pass this value to google. but, in this case, we may want to get it 'rounded' as store does for users.

 

if somebody found out how to do this, i (and maybe not only me) will appreciate it, of course

in the meantime, i'll try to figure it out, though i can be everything except a good programmer :D

Link to comment
Share on other sites

I was hoping I could get some help installing this with STS4. I just added a combination of osCommerce Google Analytics module v.1.2.2 and google analytics with sts4 from this contribution http://www.oscommerce.com/community/contri...oogle+analytics. I wont know for sure if this is working for 24 hours but I think I have installed the checkout_success.php code wrong because it displays some information that is not supposed to be displayed. Here is an example of what is displayed to the user on the last page of the checkout process, that shouldn't be displayed: UTM:T|27||32.15||8.45|Springdale|Utah|United States UTM:I|27|161|Bumbleberry Jams 8oz (6 ct)|Bumbleberry Jam|23.70|1

 

 

Where did I go wrong?

 

Here are the instructions I fallowed for checkout_success.php:

 

 

3. Edit checkout_success.php -

 

ADD right ABOVE the </body> tag (the bottom of the page)

 

 

 

 

 

<?php

// osCoders.biz - Analystics - start

include(DIR_WS_MODULES . 'analytics/analytics.php');

// osCoders.biz - Analistics - end

?>

 

 

and in the GOOGLE ANALYTICS E-COMMERCE WITH STS4 I did the fallowing to checkout_success.php:

 

1 - install the google analytics files from the package as discribed.

2 - in checkou_success.php add just before :

 

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

</table></form></td>

<!-- body_text_eof //-->

 

this code:

<?php

//google analytics

require(DIR_WS_MODULES . 'analytics/analytics.php')

?>

 

 

Thank you for any help.

Link to comment
Share on other sites

  • 2 weeks later...

Can someone please detail what is required to get GA working with the PayPal IPN module. I have seen comments on here about people getting it working, but everyone seems to be keeping the details to themselves. Please can someone help out all the people who are unable to figure this out for themselves.

 

Thanks,

 

Allen

http://www.healthy-living-products.co.uk

http://www.mavis-crafts.com

Edited by AllenConquest
Link to comment
Share on other sites

Hi all,

 

i don't know if anyone had already posted this, but i found this problem:

 

Using multiple tax rates doesn't work with this analytics module (only one tax rate is send)

 

I changed this in ../modules/analytics/analytics.php line:48:

$analytics_tax = number_format($totals['value'], 2,'.','');

into:

$analytics_tax += number_format($totals['value'], 2,'.','');

 

to add up all tax rates.

 

It seems to work, hope this helps others as well.

 

Bauke

Link to comment
Share on other sites

rather than go through the rigmoral of installing a contrib, why not just include the code in your footer.php?

That's what i did and it works fine.

SolarFrenzy

Solar powered gadgets at down to earth prices.

 

CheekyNaughty

Promoting British Design

Link to comment
Share on other sites

  • 2 weeks later...

We 've been told that Analystics won't work with authorize.net because when you return from Authorize.net their URL is in the browser address instead of checkout_success.php.

 

Anyone heard of that? Had that problem?

 

I don't 100% follow the argument as we are still sending the tracking details over. Wouldn't it work provided we don't filter to only accept tracking from the domain?

Link to comment
Share on other sites

  • 2 weeks later...

Hello, I have just installed the "Google Analytics module" contribution, it's really great, but I was wondering if can be used another function that I use with the database.

 

I usually search the products that the users have seen in the website, i search it in various tables in the database, so I can email them with special offers.

 

I was wondering if I can use it with Analytics, I search in google help and found only this

 

http://www.google.com/support/googleanalyt...opic=&type=

 

In addition to this, can be use this code to segment the users by the categories than have seen in the site ?

 

I opened a new topic in http://www.oscommerce.com/forums/index.php?showtopic=275566

 

Thanks!!

 

Hernan

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
I've sorted this thanks, it turns out the previous developer hadn't setup the IPN callback correctly.

timgaunt,

 

Could you please let us know what you did with the PayPal IPN to make it work with Google Analytics ecommerce tracking?

 

Can someone please detail what is required to get GA working with the PayPal IPN module. I have seen comments on here about people getting it working, but everyone seems to be keeping the details to themselves. Please can someone help out all the people who are unable to figure this out for themselves.

 

Thanks,

 

Allen

http://www.healthy-living-products.co.uk

http://www.mavis-crafts.com

Please, if you have ecommerce conversions tracking with PayPal IPN, without the customer clicking to return to the site (because most don't), let us know what you have done. It would be greatly appreciated.

 

Travis Cable

Link to comment
Share on other sites

  • 1 month later...

Having some issues where after I added the following code to my includes/footer.php page Google Analytics still isn't able to recognize the code. I even viewed the source within the browser and it was there, but still nada from Google's end. Any idea?

 

Tracking code not verified

Check Status

Link to comment
Share on other sites

I've installed Google Analytics E commerce Integration as follow

 

Google Analytics E commerce Integration

 

 

This is a small hack put together to enable google analytics transaction tracking, I am by no way a programmer, if you have corrections. Please submit them. This is a pretty easy addition to your checkout system, it does require that you have a google analytics account setup for your site as an ecommerce site. You MUST also have the google tracking code installed on your site, (if you need help with that there is a contribution for that http://www.oscommerce.com/community/contributions,3756)

Please ensure that you either include the google tracking code from the footer of the document. OR ensure that where ever you put it in checkout_success.php it is after the call to urchin.js or the function __utmSetTrans() wont be defined and you will get errors in your JS console.

 

NOTE: My version is OSC is heavily modified. Line numbers will not match up to yours.... good luck.

 

We will be modifying two files for this

/catalog/checkout_process.php

/catalog/checkout_success.php

 

 

 

Good Luck

Shane

 

 

------- INSTRUCTIONS --------

backup your whole /catalog folder

backup your whole database

This is always a good way to start the day, helps for when you accidentally breaksomething

 

backup /catalog/checkout_process.php

 

Starting in /catalog/checkout_process.php

 

Right Around Line 13

 

include('includes/application_top.php');

 

 

----- ADD IN BELOW IT -----

 

// GOOGLE ANALYTICS BOF

// Reset the two variables in case we are processing a second order in the same session.

 

$_SESSION['google_analytics'] = '';

$google_analytics = '';

 

// GOOGLE ANALYTICS EOF

 

 

 

 

 

Half way down the page around line 227

 

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

 

 

----- ADD IN BELOW IT -----

 

// GOOGLE ANALYTICS BOF

 

$category = 'NULL';

 

$prod_category = tep_db_query("select c.categories_name as cname from categories_description as c, products_to_categories as p where p.categories_id = c.categories_id and p.products_id = '". $order->products[$i]['id'] ."' limit 1");

 

if (tep_db_num_rows($prod_category) > 0) {

$pc_values = tep_db_fetch_array($prod_category);

$category = $pc_values['cname'];

}

 

$google_analytics .= 'UTM:I|'.$insert_id.'|'.$order->products[$i]['model'].'|'.$order->products[$i]['name'].'|'. $category .'|'. $order->products[$i]['price'].'|'.$order->products[$i]['qty']."\n";

 

 

// GOOGLE ANALYTICS EOF

 

 

 

 

 

 

Next addition goes below this line, roughly Line 273

 

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

 

 

----- ADD IN BELOW IT -----

 

// GOOGLE ANALYTICS BOF

 

// Peter Anderson added the following line to register the session:

session_register('google_analytics');

 

$_SESSION['google_analytics'] = 'UTM:T|'.

$insert_id .

'|Web Sales|'.$order->info['total'].'|'.

$order->info['tax'].'|'.

$order->info['shipping_cost'].'|'.

$order->customer['city'].'|'.

$order->customer['state'].'|'.

$order->customer['country']['iso_code_2']."\n".$google_analytics;

 

 

// GOOGLE ANALYTICS EOF

 

 

Close the file.

Open up /catalog/checkout_success.php

 

At the bottom of the file, below the footer include line

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

 

Insert this code.

 

 

// GOOGLE ANALYTICS BOF

<!-- Google analytics transaction tracking -->

<form style="display:none;" name="utmform">

<textarea style="display:none;" id="utmtrans">

<? echo $_SESSION['google_analytics']; ?>

</textarea>

</form>

 

<script type="text/javascript">

__utmSetTrans();

</script>

<?

// reset these bits.

$_SESSION['google_analytics'] = '';

tep_session_unregister('google_analytics');

 

// GOOGLE ANALYTICS EOF

?>

 

That should be it, ensure when testing this that you dont have filters in google analytics setup to ignore your IP, it could keep your orders from being tracked. Make sure to check your handy dandy Javascript console for errors and view source to ensure everything shows up.

 

I don't know when i'll see the result on the google report, but i guess I've to wait a day or two.

 

My problem is that after i did theese changes my order confirmation mail look like this.

 

 

doppresent.sen------------------------------------------------------nOrdernummer: 1617nDetaljerad faktura: http://www.doppresent.se/account_history_i...617nOrderdatum: Söndag 11 November, 2007nnProduktern------------------------------------------------------n1 x Baby Art Print (549202) = 199.00Krn------------------------------------------------------nTotalt exklusive frakt: 199.00KrnHämtas hos oss (Hämta hos oss, ring för att komma överens om en tid): 0.00KrnVarav moms 25%: 39.80KrnTotalt: 199.00KrnnLeveransadressn------------------------------------------------------nJohan SundbergnHöjdvägen 20n14251 SkogåsnSverigenTel: 08-7719100nnFakturaadressn------------------------------------------------------nJohan SundbergnHöjdvägen 20n14251 SkogåsnSverigenTel: 08-7719100nnBetalningssättn------------------------------------------------------nFörskottsinbetalningnnBetala till: Bankgiro: 5347-5018

 

Looks like the line brakes dosent work anymore, and after each line I have "n".

Do you have any idees??

Link to comment
Share on other sites

  • 2 weeks later...

HELP, Ive had this module working perfectly for over a year, with all ecomerce tracking and goal funnel, etc.

 

 

BUT Ive noticed recently that although google is tracking the sites revenue it no longer tracks checkout_success.php. Have google made some changes I dont know about as the code I have hasn't been changed.

Link to comment
Share on other sites

  • 3 weeks later...

hi !

I'm using this contrib without any troubles, but is anyone here aware that the tracking code has been updated, and we need to change the lines at the bottoms of each pages ? (from urchin.js to ga.js)

here is a migration guide from Google.

http://www.google.com/analytics/GATCmigrationguide.pdf

 

My point is :

we'll need to modify the contrib in order for it to work with the new way of tracking...

Google will continue to provide service for urchin.js for a year from now.

 

more details can be found here :

http://code.google.com/apis/analytics/docs/

 

and of course on the official analytic blog :

http://analytics.blogspot.com/

Link to comment
Share on other sites

hi !

I'm using this contrib without any troubles, but is anyone here aware that the tracking code has been updated, and we need to change the lines at the bottoms of each pages ? (from urchin.js to ga.js)

here is a migration guide from Google.

http://www.google.com/analytics/GATCmigrationguide.pdf

 

My point is :

we'll need to modify the contrib in order for it to work with the new way of tracking...

Google will continue to provide service for urchin.js for a year from now.

 

more details can be found here :

http://code.google.com/apis/analytics/docs/

 

and of course on the official analytic blog :

http://analytics.blogspot.com/

 

I'm also curtious about the new ga.js tracking method. Is anyone developing this yet? Looks like the analytics.php file will need to be rewritten. Hopefully someone a little better at php than me will work on this and post it in the contributions!

Link to comment
Share on other sites

  • 2 weeks later...
I'm also curtious about the new ga.js tracking method. Is anyone developing this yet? Looks like the analytics.php file will need to be rewritten. Hopefully someone a little better at php than me will work on this and post it in the contributions!

 

Yes I too would like to know when a contribution will be made for the newest ga.js script.

I tried installing the original mod using the ga.js script in place of the legacy urchin script.

Does anyone think there should be problems? I try to run the verifyer but Google cannot detect a GA installation. Go figure.

 

 

Thanks for a great contrib. As always, any and all help is much appreciated

 

John

Edited by jcisar
Link to comment
Share on other sites

  • 2 weeks later...
Yes I too would like to know when a contribution will be made for the newest ga.js script.

I tried installing the original mod using the ga.js script in place of the legacy urchin script.

Does anyone think there should be problems? I try to run the verifyer but Google cannot detect a GA installation. Go figure.

Thanks for a great contrib. As always, any and all help is much appreciated

 

John

 

 

We have written a new module for Google Analytics E-commerce, with the new ga.js script.

See http://addons.oscommerce.com/info/5652 for the installation guide and files

 

Installation will take about 5 minutes ;)

 

greetings,

 

Tomas

 

--------------

IT WORKS!

http://addons.oscommerce.com/info/5652

--------------

Link to comment
Share on other sites

I installed this contribution yesterday, and it seems to be working, as I have stats today for most of the areas, but I am not getting the ecommerce tracking to work and my adwords campaigns are not showing. I know people are coming from google adwords and that I have sales. Maybe it is that my account is too new for proper tracking to have begun.

 

Any thoughts?

Link to comment
Share on other sites

  • 2 weeks later...

Just a quick observation.

 

I am running CRE loaded with template system.

This observation is for those who are running on CRE or have template system integrated.

If someone does not want to create second footer page, or will have problems with the code (template system) here is a simple solution.

 

The idea is to show tracking code before </body> tag on every page but not checkout_success.php. On this page you need only include analytic file on the top of the page. According to Google if you will have both codes your analytics might not be correct.

For those with cre or template system replace in templates/**yourtemplatename**/main_page.tpl.php --or where you are keeping Google tracking code replace:

 

 

<script type="text/javascript">

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

</script>

<script type="text/javascript">

var pageTracker = _gat._getTracker("xx-xxxxxxx");

pageTracker._initData();

pageTracker._trackPageview();

</script>

 

and place this:

 

<?php

if ($_SERVER['SCRIPT_NAME'] == '/checkout_success.php') {

echo '';

} else {

?>

<script type="text/javascript">

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

</script>

<script type="text/javascript">

var pageTracker = _gat._getTracker("xx-xxxxxx");

pageTracker._initData();

pageTracker._trackPageview();

</script>

<?php

}

?>

 

What it will do , it will hide Google tracking code at /checkout_success.php page.

Those with out template systems or CRE, can replace the same on checkout_success.php page.

I believe it is little less confusing and maybe should be integrated with main installation.

Link to comment
Share on other sites

We have written a new module for Google Analytics E-commerce, with the new ga.js script.

See http://addons.oscommerce.com/info/5652 for the installation guide and files

 

Installation will take about 5 minutes ;)

 

greetings,

 

Tomas

 

--------------

IT WORKS!

http://addons.oscommerce.com/info/5652

--------------

 

 

I believe it does, but I wanted to make sure: does this contrib track both regular traffic in and around my store (in addition to the e-commerce data)?

Link to comment
Share on other sites

Hi guys.

 

Thanks for the great module

 

I have everything setup and my orders are tracked with Google Analytics.

 

My problem is that my order revenue is showing incorrectly.

 

An order with the value of 2500 is showing up as 2.00 in Google.

 

Any ideas as to what can cause this.

 

Cheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...