TheHostingHeroes Posted May 25, 2011 Share Posted May 25, 2011 Hey People! Has anyone got google Analytics Ecommerce working in WHMCS? I have set my whmcs to forward to gateway on new orders and followed the instructions on the wiki for integration. However months later this still does not work for me. Below is a copy of my /cart/complete.tpl if anyone can spot something wrong do let me know <link rel="stylesheet" type="text/css" href="templates/orderforms/cart/style.css" /> <p align="center" class="cartheading">{$LANG.orderconfirmation}</p> <p>{$LANG.orderreceived}</p> <div class="cartbox"> <p align="center"><strong>{$LANG.ordernumberis} {$ordernumber}</strong></p> </div> <p>{$LANG.orderfinalinstructions}</p> {if $invoiceid && !$ispaid} <div class="errorbox">{$LANG.ordercompletebutnotpaid}</div> <p align="center"><a href="viewinvoice.php?id={$invoiceid}" target="_blank">{$LANG.invoicenumber}{$invoiceid}</a></p> {/if} {if $ispaid} <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")); var pageTracker = _gat._getTracker("UA-REMOVED-1"); pageTracker._trackPageview(); pageTracker._addTrans( "{$orderid}", "", "{$amount}", "0", "0", "{$city}", "{$state}", "{$country}" ); pageTracker._addItem( "{$orderid}", "{$packageid}", "{$name}", "{$type}", "{$amount}","1" ); pageTracker._trackTrans(); </script> <!-- Google Code for Payment Complete Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 1068543888; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "LjrLCMSOjAIQkN_C_QM"; var google_conversion_value = 0; /* ]]> */ </script> <script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/1068543888/?label=LjrLCMSOjAIQkN_C_QM&guid=ON&script=0"/> </div> </noscript>{/if} <p align="center"><a href="clientarea.php">{$LANG.ordergotoclientarea}</a></p> {php} $orderid = $this->get_template_vars('orderid'); $userid = $_SESSION["uid"]; // get client data $result = select_query("tblclients","city, state, country",array("id"=>$userid)); $data = mysql_fetch_array($result); $city = $data["city"]; $state = $data["state"]; $country = $data["country"]; $this->assign('city',$city); $this->assign('state',$state); $this->assign('country',$country); // get package name $result = select_query("tblhosting","packageid",array("orderid"=>$orderid)); $data = mysql_fetch_array($result); $packageid = $data["packageid"]; $result = select_query("tblproducts","name, type",array("id"=>$packageid)); $data = mysql_fetch_array($result); $name = $data["name"]; $type = $data["type"]; $this->assign('name',$name); $this->assign('type',$type); $this->assign('packageid',$packageid); {/php} PS the REMOVED bit in the analytics code, usually would show my GA ID. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.