Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal Ipn And Google Analytics


piou

Recommended Posts

hy dudes,

 

 

i've osCommerce_PayPal_IPN_v2.2 and google_analytics_module_v1.2.2 running.

 

i've just one problem:

 

the orders payed via paypal aren't recognized by my google analytics account!

where in ipn.php and how do i have to call the analytics.php to submite also these orders to google?

 

in the google analytics install-manual it states:

 

2.  Edit checkout_success.php  - 

INSERT into the  <body	tag the following code:

		   onLoad="java script:__utmSetTrans()"


  Finally the line should look like this:


  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="java script:__utmSetTrans()">




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

 

i think this call has to be integrated into ipn.php!

 

but it should be executed only if paypal confirmes the payment to be completed.

 

thanxs 4 any help

Link to comment
Share on other sites

The file checkout_success.php is used by orders paid by PayPal so there should be no need to make any modifications to the ipn.php - if you do, then you'd duplicate the code as it would be called from both the ipn.php & checkout_success.php.

 

With the PayPal IPN, the only file which is really important is checkout_process.php -> this file is mostly bypassed by the PayPal IPN so any modifications to this file must be duplicated in the ipn.php file. All other checkout files (in. checkout_success.php) however are used as normal.

 

I don't think you can easily modify the Google code to only recognise confirmed payments ... if you wanted to do this, the you'd have to delete the existing code & write your own script which can handle this check.

 

Also - can you confirm what other payment types you use & whether they work with Google Analytics?

 

all the best - Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

The file checkout_success.php is used by orders paid by PayPal so there should be no need to make any modifications to the ipn.php - if you do, then you'd duplicate the code as it would be called from both the ipn.php & checkout_success.php.

 

With the PayPal IPN, the only file which is really important is checkout_process.php -> this file is mostly bypassed by the PayPal IPN so any modifications to this file must be duplicated in the ipn.php file. All other checkout files (in. checkout_success.php) however are used as normal.

 

I don't think you can easily modify the Google code to only recognise confirmed payments ... if you wanted to do this, the you'd have to delete the existing code & write your own script which can handle this check.

 

Also - can you confirm what other payment types you use & whether they work with Google Analytics?

 

all the best - Terra

 

well

what mentioned by piou is not completely absurd...

it's true that PayPal IPN doesnt modify checkout_success.php (which contains the analytics code).

The problem is that many PayPal user are NEVER getting back to checkout_success.php after the completed the order on paypal.

so we never get the information of the order to analytics.

In fact we are having the same problem on googlecheckout, as we are using it in the same way as for Paypal IPN..

 

any suggestion?

thanks! jacopo

Expresionario.com | Pura Sub-cultura!

Link to comment
Share on other sites

jacopo! exactly that is the point!

 

the rate of customers that return to the checkout_success.php is very low!

 

so most of the orders aren' sent to google analytics!

 

one possible solution could be to call this analytics comunication in the ipn.php if an order is completed. and in addition to that there should be something like "if payment ==paypal skip analytics code" in the checkout_success.php.

 

unfortunately i am not skill enough in code-ing php ...

 

greets

Link to comment
Share on other sites

  • 2 months later...

Hi there!

 

jacopo! exactly that is the point!

 

the rate of customers that return to the checkout_success.php is very low!

I experience the same problem, although I did a lot of testing where I did come back to the checkout_success.php.

I think the problem is rather, that the ipn.php uses different variables than the other payment modules or the checkout_process.php (see ipn.php around line 250):

 

// $order variables have been changed from checkout_process to work with the variables from the function query () instead of cart () in the order class

 

I suppose the google_analytics_module cant't read these paypal-ipn variables?

 

Have you found any solution yet?

 

Greets

cob-web

Link to comment
Share on other sites

  • 1 month later...

i guess there is still nothing proceeding on this issue, right? mhh.. thats very bad!

 

google checkout (yeah, same company!) found a solution that can work with google checkout ipn module:

http://code.google.com/apis/checkout/devel...rationAlternate

 

the thing is that googlechekout is designed to submit information to Analytics even when user doesnt go back to checkout_success.php, paypal doesnt!

 

the only way i see would be to change paypal_ipn.php so that it connects to Analytics everytime it receives an update.

But as Analytics is desinged to receive calls from a JS and i belive google guys are smart enough, it may be difficault to trick it that way... who got some spare time to try that? :D

Expresionario.com | Pura Sub-cultura!

Link to comment
Share on other sites

  • 7 months later...

Anything new on this problem. This is a major flaw between these two modules.

 

The google analytics is great stuff but it's hard to ignore the fact the majority of the paypal orders are not included in your totals.

Link to comment
Share on other sites

  • 10 months later...
  • 2 months later...

Anyone? Anyone? Bueller?

 

Is there someone out there who has solved this issue? We get a lot of customers using Paypal, and the majority of them do not return to the checkout_success.php page so we are missing lots of valuable e-commerce transaction data.

 

Please, PHP gurus, we beg you to respond with a solution.

Link to comment
Share on other sites

  • 2 months later...
Anyone? Anyone? Bueller?

 

Is there someone out there who has solved this issue? We get a lot of customers using Paypal, and the majority of them do not return to the checkout_success.php page so we are missing lots of valuable e-commerce transaction data.

 

This didn't solve the actual problem, but made a difference in results. A couple of years ago, we worked on an osC site for a client using PayPal.

 

We simply added some text to /checkout_confirmation.php for people checking out with PayPal, telling them that they would now be sent over to PayPal, and to make sure that they clicked on the return link to come back to the client's site for their order confirmation # and other important information.

 

We laid it out really clearly with the steps (pay with PayPal account or credit card, etc), and included a screenshot of the text link on PayPal's site they needed to click on to come back. The store didn't process a lot of orders, but 10 out of 10 PayPal transactions were recorded in Google Analytics because people clicked back to the checkout_success.php page on the site.

 

Unfortunately, the site is no longer around so I can't give the example, but it worked out well at the time...

Link to comment
Share on other sites

  • 2 weeks later...

I had a similar problem but not for OSC for a custom website.

 

You won't be able to add GA tracking code the IPN scripts as the GA code is Javascript which is client side scripting. When Paypal calls your IPN it will not execute any javascript returned - it's not a browser.

 

My understanding of the GA code (limited) is that it calls an image with paramaters, maybe possible to fake it by making the call to the images yourself from IPN but someone will need to understand the GA code to do so. This would prob catch transactions but would not link them to any adwords you may have as the cookie will not be available to the IPN script.

 

There is an option for Auto Return in paypal, it may increase the chance of getting the cust back to your store. After payment they are redirected back anyway in 5secs, there is also a click to go back to merchant button. This is default off I think. Find it in Profile > Website Payments Standard (or Pro)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...