datex Posted June 29, 2011 Share Posted June 29, 2011 I recently upgraded to WHMCS 4.5.2 -and needed to reimplement Google Analytics tracking e-commerce conversions - But I have not had any success with it. I tried the method described in WHMCS Documentation. Now I have placed the following code in header.tpl - just before </head> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-17503xxxx-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script> And the following at the end of complete.tpl - for the orderform I use {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} <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-17503xxxx-1']); _gaq.push(['_trackPageview']); _gaq.push(['_addTrans', "{$orderid}", "", "{$amount}", "0", "0", "{$city}", "{$state}", "{$country}" ]); _gaq.push(['_addItem', "{$orderid}", "{$packageid}", "{$name}", "{$type}", "{$amount}","1" ]); _gaq.push(['_trackTrans']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script> Any idea what I'm doing wrong?? Should I not be able to see the e-commerce tracking code in the source when I checkout? 0 Quote Link to comment Share on other sites More sharing options...
datex Posted July 1, 2011 Author Share Posted July 1, 2011 Anybody having success with tracking ecommerce conversions in WHMCS 4.5.X? 0 Quote Link to comment Share on other sites More sharing options...
lukewd Posted July 19, 2011 Share Posted July 19, 2011 also waiting on a solution for this... 0 Quote Link to comment Share on other sites More sharing options...
multisoft Posted July 20, 2011 Share Posted July 20, 2011 to add Google Analytics use this code to footer : <script type="text/javascript"> {literal} var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); {/literal} </script> 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted July 29, 2011 Share Posted July 29, 2011 to add Google Analytics use this code to footer : <script type="text/javascript"> {literal} var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); {/literal} </script> Google Analytics is working fine but the conversions are not since 4.5.2 upgrade. Using the code suggested here: http://docs.whmcs.com/Google_Analytics_Integration conversions were previously showing but not accurately - approx. 50% accurate! This really needs resolving, would greatly appreciate it if someone could either confirm that conversion code is working as per the link or that we need to add new code and provide the code for us please. In anticipation of help, thank you! 0 Quote Link to comment Share on other sites More sharing options...
lukewd Posted July 29, 2011 Share Posted July 29, 2011 why doesn't someone open a ticket? and then share the results with the rest of us? 0 Quote Link to comment Share on other sites More sharing options...
getup Posted July 29, 2011 Share Posted July 29, 2011 The conversion code from http://docs.whmcs.com/Google_Analytics_Integration has never been accurate. It only tracks the total transaction amount and 1 product. You can open a ticket but they do not provide support. We have developed our own version which has more options and does work: http://www.whmcs.com/members/communityaddons.php?action=viewmod&id=293 and http://forum.whmcs.com/showthread.php?p=194163. If it stops working for any reason you can contact us as we do provide support on this one. 0 Quote Link to comment Share on other sites More sharing options...
kmm2908 Posted July 29, 2011 Share Posted July 29, 2011 why doesn't someone open a ticket? and then share the results with the rest of us? or... Why don't you open a ticket and share the results with us Agree with @getup's comment above, this regularly gets ignored and has never been addressed by Matt. Cannot understand why, as everyone must want to track their conversions and Google for all their many faults must be one of the most common ways of doing that. @getup looking at your addon now - thanks for the link. 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.