22 November 2017

Pavel Karpovskii

Head of Marketing

BILLmanager and Google Analytics. From clicks and views to the cost evaluation of marketing performance

BILLmanager с Google Analytics

Pavel Karpovskii
Head of Marketing

We have released a cycle of articles about using BILLmanager for starting hosting business recently. However, I believe that the cycle won’t be complete if we don’t devote a special article to analytics because a data analysis is a key to building any successful business. In the given article we’ll tell you how to integrate BILLmanager with Google Analytics (GA), a popular system of web-analytics and what benefits will it bring to you.

Google Analytics and BILLmanager

In April 2015 we have added Google Analytics integration to BILLmanager Corporate. The GA itself is familiar to the majority of website owners, it’s a convenient tool for tracking visits, views and refuses. Thanks to the integration, it became possible to perform an accurate money evaluation of marketing, analyze promotion channels efficiency, adjust marketing strategy on time and utilize a budget wisely.

Before and after

Since a website and a billing platform are different entities, it was hard to correlate payments data of clients with channels of their attraction. There was no connection between profit and marketing expenses. And in ISPsystem, we felt this pain by ourselves.

We spent money on advertising, built relations with partners and invested in SEO. And as a result, we saw clients coming and making purchases, the problem was that they did it from our billing, not from our website. If a client pressed “buy” button on the website it didn’t mean that he would make an actual payment. We could only guess which attraction channels really worked and which doesn’t.

So what do we have now? From a magic dream, BILLmanager-GA integration became a real tool for an admin! Payment data is transferred to GA and thanks to using a User-ID, it is easy to correlate it with exact users from the billing with the higher accuracy.

Installing Google Analytics on a website

Let’s proceed with the technical part now. Before integrating BILLmanager with Google Analytics, we need to install analytics script on our website.

Step 1. Create a new script. It is a simple task that doesn’t deserve a detailed description. The only thing I’d like to mention is that you need to activate an enhanced e-commerce when creating the script.

Google Analytics start page

Creation of a new Google Analytics script

Step 2. In an admin’s section, we get global site tag (tag.js) (1) which is a tracking code and tracking ID (2). You need to add the code to the code of your website while the tracking ID should be entered in BILLmanager.

Google Analytics start page

Getting the tracking code

Step 3. There are two ways of adding the global site tag (tag.js) to a website:

  1. Edit a source code by yourself.
  2. Install GA plug-in for CMS that will edit the code for you.

It is not necessary to have a web-developer for using the first way. There are many detailed guides online. For the second way you don’t need to have special skills at all, the only thing is that you need to find a plugin that supports User-ID. I’ll explain it later why it's important.

I have chosen the manual way for my Wordpress website. The tracking code should be added to an admin’s side of CMS: go to «Appearance» -> «Editor», choose header.php, add the code right after tag and save changes.

Google Analytics start page

Adding the global site tag (tag.js) to a website in WordPress

The tracking code will work for every page of my Website. The script can be used for analyzing a website’s visits.

If you want to check whether everything works right, go to “Real-time” section in Google Analytic, the rest reports will be null till they reach a critical mass. Also, there is an extension for Google Chrome that checks the script’s code for errors.

Integrating BILLmanager with Google Analytics

For us, it’s not enough to see only clicks, visits and views. We want to know how much money has an exact attraction channel brought to us.

Step 4. Go to BILLmanager, in the left menu choose «Provider» -> «Providers». Choose the provider we need and click “Edit”. Scroll down to the «Google Analytics» block and add the tracking ID we received at the second step in the corresponding field. Please note that User ID must be activated!

Google Analytics start page

Activation of Google Analytics in BILLmanager

Step 5. Let’s check the billing-GA integration now. I will make several transactions, repeating a complete order cycle as a regular user. Let’s log-in into Google Analytics now: as you can see from the screenshot, there were 27 transactions on my test website. If there were any visits ended up with a conversion from other websites, in Referrals section we could see which exact website had brought money to us.

Google Analytics start page

Checking of the integration

Of course, net income per channel is not the only indicator you can see in Google Analytics. You can also watch product groups, tariff plans, transaction IDs and much more.

Limits and data inaccuracy

Unfortunately, payment data from Google Analytics is not 100% true. There may be several reasons for this.

In most cases, users make their first purchase from the billing after pressing Buy button on the website. The second purchase and the following ones are usually made from the billing directly. Users may log-in in their personal area from different devices and empty a browser's cache sometimes. As a result, Google Analytics loses the information regarding the initial attraction channel and ignores the second and following transaction. It's almost guaranteed for such services as SSL-certificates or domain names since they are usually bought/renewed once a year. The analytics either ignores such payments or believes they were made by two different clients. It is hard to say how much money has the exact channel brought in the end.

This is why I recommend using User-ID function I've mentioned above. It can give us a higher confidence.

User-ID: getting personal

User-ID was introduced by Google Analytics in 2014. Previously it was impossible for GA to collect personal information of a website visitors. It was available only to a website owner after asking their approval. With User-ID it became possible to correlate GA data with user identification in a CMS, CRM or BILLmanager. However, it is not the main advantage!

After enabling User-ID, BILLmanager will be able to transfer a user's ID to GA with every payment he makes. No matter if he purchases the first service one year after registration and renews it next year. You will have a complete picture of efficiency for every attraction channel and track ROI (Return on Investment) for it.

Enabling User-ID

Step 1. Go to Google Analytics from admin's section. At the Property level in tracking code go to User-ID and create a new view with User-ID tracking. Don't forget to enable eCom tracking!

Google Analytics start page

Enabling User-ID feature in Google Analytics

The given view will accumulate statistics for the users who have registered in the billing. For watching mixed information a standard view should be used.

Step 2. In order to enable User-ID tracking at your website, you need to moify the code of your Google Analytics script. Please keep in mind that in Wordpress you need to do it in «External Look» -> «Editor» -> «header.php».

function getCookie(name) {
var matches = document.cookie.match(new RegExp(name + '=([^;]+)'));
return matches ? matches[1] : undefined;
}

var USER_ID = getCookie('ga-billmgr-uid');
if (USER_ID != undefined)
gtag('set', {'user_id': 'USER_ID'});

Step 3. After this GA starts collecting data individually for every user.

Google Analytics start page

Statistics by users in Google Analytics

Using User-ID with an old analytics.js script

There may be a chance that your website already has Google Analytics script installed. Currently, Google offers to install Global Site Tag (gtag.js) for every new user. However previously there was Universal Analytics (analytics.js) script instead and ispsystem.com had this script installed.

Analytics.js code is available in Google dev guides:

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() { (i[r].q = i[r].q||[]).push(arguments)}, i[r].l = 1*new Date() ;a=s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async=1; a.src=g;m.parentNode.insertBefore(a,m) })
(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

After inserting User-ID code, the script will look like this:

<!-- Google Analytics -->
<script async>
   
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

function getCookie(name) {
var matches = document.cookie.match(new RegExp(name + '=([^;]+)'));
return matches ? matches[1] : undefined;
}

var USER_ID = getCookie('ga-billmgr-uid');
if (USER_ID != undefined)
{
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
ga('set', 'userId', USER_ID);
}
</script>
<!-- End Google Analytics -->

 

Well, that’s it, I hope this article was helpful for you. In my following publication, I will tell about the most important Google Analytics tools, that can be handy for the new companies who provide hosting, resell domains, SSL certificates, and software.

P.S. Some technical information

1. Data uploading from BILLmanager to Google Analytics is launched by a crontab task — sbin/mgrctl -m billmgr google.analytics.export. By default, it’s run every ten minutes.

2. BILLmanager data is transferred to GA as follows:

analytics_google

  1. item — service code,
  2. cost — service value,
  3. date — data processing date.

analytics_google_expense

  1. expense — expense code,
  2. cost — expense value,
  3. date — data processing date.

analytics_google_registration

  1. account — client ID,
  2. ga-billmgr-uid — client ID related with User-ID,
  3. date — registration date.

Project table keeps data collection settings

  1. ga_counter — Tracking ID for Google Analytics,
  2. ga_type — data export type for Google Analytics, expense - upload expenses, item - upload services.

Pavel Karpovskii

Head of Marketing