Latest News: (loading..)
osCoders

Google Analytics module

390 posts in this topic

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Thank's a lot about the information about https://ssl.google-analytics.com/urchin.js so now i can work with https too!

 

I have read some forums, and i don't see any clear solution how to make work PayPal IPN vs. GA

 

Have somebody find a way to track the PayPal IPN payments by G. Analytics?

 

 

 

 

Thank's

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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://forums.oscommerce.com/index.php?showtopic=275566

 

Thanks!!

 

Hernan

Share this post


Link to post
Share on other sites

I had a problem getting ecommerce tracking to work properly.

Google cannot read the code in checkout_success.php if you tell your robots.txt to exclude /catalog/.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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??

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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/

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

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

Share this post


Link to post
Share on other sites

When I installed this latest contrib, the checkout_succes page got stuck.

Just a blank screen for a long time.

 

What did I do wrong?

 

Marco

 

PS also some security issues popped up.

Edited by Marco from Holland

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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)?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now