Jump to content

Google Analytics


pod

Recommended Posts

 

John, do we need to set up anything in google analytics after we follow those steps ? As it seems you need to setup a goal to track conversion rates but I am not sure the URL for the complete page.

 

Any ideas ?

 

Edit. Found another post which stated how to do this. On a side note does the goals with google analytics show where the referal came from ?

Edited by Derek
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
  • 2 weeks later...
yup, no solution to the goal conversion @ google analytics

google analytics will track the visitor and page URL, but how can I set up the GOAL Conversion?

 

Hello Kuntal,

 

To setup Google Analytics conversion, follow 2 steps below:

 

1. Add your Google Analytics code inside ../templates/footer.tpl

 

2. Configure your Goal inside your google analytics settings.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

Still cannot get this to work.

 

We can see all our visitors etc. in Analytics by using the code from the Wiki.

 

However, in the eCommerce section of Google Analytics, its only showing one order/transaction for yesterday when we had at least 10.

 

Any ideas anyone?

Link to comment
Share on other sites

Hello Kuntal,

 

To setup Google Analytics conversion, follow 2 steps below:

 

1. Add your Google Analytics code inside ../templates/footer.tpl

 

2. Configure your Goal inside your google analytics settings.

 

How do we do step 2, configure the goals?

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • 2 weeks later...
Since Google changed to new GA code, asking for it to be placed before closing </head> now instead of </body>, maybe we could have the wiki updated for this and some instruction for best WHMCS practice ecommerce / goal settings please?

http://wiki.whmcs.com/Google_Analytics_Integration

 

Many thanks,

 

- Vincent

 

I use the ordercomplete.tpl , but the </head> section is contained in header.tpl so did you just add the GA code in header.tpl sitewide????

Edited by AndyW
typo
Link to comment
Share on other sites

The new Asynchronous GA snippet seems to be working properly for me. I dropped the script just before the end of the </head> tag in my header.tpl and my sites header.php. Then I followed the instructions in the wiki http://wiki.whmcs.com/Google_Analytics_Integration and modified the code to look like the following in my complete.tpl of the active order form template.

 

{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-XXXXX-X']);
 _gaq.push(['_trackPageview']);
 _gaq.push(['_addTrans',
   '{$orderid}',	// order ID - required
   '',				// affiliation or store name
   '{$amount}',	// total - required
   '0',			// tax
   '0',			// shipping
   '{$city}',		// city
   '{$state}',		// state or province
   '{$country}'	// country
 ]);

  // add item might be called for every item in the shopping cart
  // where your ecommerce engine loops through each item in the cart and
  // prints out _addItem for each
 _gaq.push(['_addItem',
   '{$orderid}',	// order ID - required
   '{$packageid}',	// SKU/code - required
   '{$name}',		// product name
   '{$type}',		// category or variation
   '{$amount}',	// unit price - required
   '1'				// quantity - required
 ]);
 _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

{literal}
 (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>

 

I dropped that code block at the bottom of the complete.tpl page. Make sure you use your own web property ID in place of 'UA-XXXXX-X' located in the js portion. You should be good to go I think. I've only got two days of stats so far but it looks like everything is working including Ecommerce tracking. If you want to know what I modified keep reading.

 

I didn't change any of WHMCS {php} because it didn't look like I needed to. I copied the variables from the example GA snippet in the wiki into the new GA snippet from Google. It has been my experience Google Analytics doesn't change the order of the array for their variables but always be sure to have at least the required variables (which are clearly marked in the code). I used the {literal} tag around the function ONLY so the page wouldn't break and the php variables would echo properly into the GA snippet. I'm pretty sure it's working properly. Like I said I've only got two days worth of stats so far. Ecommerce seems to be tracking properly including capturing revenue. The site is not live but I've got plenty of sources testing the site. I can post back later when I've got more stats to work with and verify.

 

Hope this helps.

Link to comment
Share on other sites

Matt & Team,

 

You can't put a price on the importance of Analytics. This should be top priority either was a built in feature or some step by step wiki documentation with details on how to do this. It really is unacceptable that even basic analytic support is difficult to implement with goal functionality also a must given we are selling products and trying to track how they come in.

Link to comment
Share on other sites

I setup ecommerce analytics on a regular basis for CRE Loaded sites. If the code we are instructed to place in the wiki instructions for WHMCS worked at all, it would (in theory) supply Google Analytics the data it needs to establish ecommerce tracking with or without goal funnel setup. The only additional instruction needed is to configure the GA account to allow ecommerce tracking.

 

At that point, ecommerce data should start to flow. Despite multiple attempts to embed this code as per the wiki (and various other forum post) instruction sets, we have not ONCE seen a transaction passed to Google Analytics.

 

Not once.

 

So - telling WHMCS users that simply following the incomplete instructions will fix their problem is not terribly helpful for two reasons. The instructions are not complete - and they don't work.

 

Should anyone setting up ecommerce tracking be able to understand from Google's documetntation that embedding this code but failing to configure the account for ecommerce tracking will result in failure of transaction reporting ? Sure.

 

Should they also be able to figure out that the UA-xxxxx-x label in the script should be replaced with their actual site tracking ID ? Sure.

 

But even addressing these issues, the code does not work in our installation and never has no matter what we've done with it.

 

One question I have is whether any one, anywhere on any server confirm that an installation of the code as stated in the wiki instructions actually works as it is given with both the footer and the complete.tpl triggering ??

Link to comment
Share on other sites

The old GA code does not work and if you try to insert the new code in to the header.tpl as instructed, the site breaks. I opened a ticket last night about GA and they still directed me to their outdated wiki page. I informed them today to read their forums as there is plenty of talk about that wiki no longer being accurate. It just sucks that doing what GA now requires breaks WHMCS. So much for that.

Link to comment
Share on other sites

  • 2 weeks later...

Stuck in the same boat, followed the wiki - sent an e-mail off the support - directed twice to the wiki!

 

Not happy, anyway I attached my files and explained how I setup GA, so hopefully this will prove to them that it is not working and that they can fix it :)

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated