开发者

Using Google Analytics with Worldpay

开发者 https://www.devze.com 2023-03-02 22:56 出处:网络
I\'m trying to get Google Analytics eCommerce tracking to play nicely with our site\'s payment gateway, Worldpay. A solution, which I\'d prefer NOT to u开发者_C百科se has been posted (link below), but

I'm trying to get Google Analytics eCommerce tracking to play nicely with our site's payment gateway, Worldpay. A solution, which I'd prefer NOT to u开发者_C百科se has been posted (link below), but involves extra clicks for the shopper, which I was hoping to avoid. http://www.tatvic.com/blog/google-analytics-worldpay-ecommerce-tracking

The shopper is taken to Worldpay's website to process cards, where no javascript is available and the GA eCommerce tracking breaks down.

Let me walk you through the steps:

  1. A shopper arrives at our site where Google Analytics is set up to successfully track their movements.
  2. The shopper clicks "ORDER" and is taken to Worldpay's website for credit card processing. The shopper completes their order on Worldpay's site and their shopping experience is over.
  3. Worldpay POST us their 'payment response message' which is sent to our designated page 'response.cfm'. This message contains various details about the order (cartID, ammount, etc..) which we file in the database as a completed order.

My question is, and please excuse my ignorance, but is it possible to use this automated payment message, sent to our response.cfm page to send all the GA data to google ? I don't want to involve the user/redirect them back to us, if I can help it.

Worldpay allow us to send our own variables to them, then return the variables in the payment response. I was hoping we could use this feature to make it work? It would be a similar solution to the link above, but wouldn't need the shopper to click the button at the very end (and get a warning message)


I know this is an old question now but as no-one has posted thought it would be worth posting my solution to this problem.

Build a response script which is purely there to handle the response, not display the message, for example response.php. Also create a page which displays a message, for example complete.php

Inside response.php include:

<?php if($_REQUEST["transStatus"] == "Y" && $_REQUEST["testMode"] != "0" && $_REQUEST["callbackPW"] == "your_password"){ 
    //update order status internally here
?>
<meta http-equiv="refresh" content="4; url=complete.php?parameters">
<?php } ?>

Replace "parameters" with any information from the booking you'd like to pass to Analytics. Inside complete.php include your Analytics code referencing to $_GET parameters as required.

For extra security i'd recommend passing an additional parameter with a secret hash (different for every transaction) and compare that in the above if statement as well.

I hope this is a useful solution :)

0

精彩评论

暂无评论...
验证码 换一张
取 消