As it relates to customer segmentation, Google Analytics might be one of the most limiting tools in the belt. Google has very restrictive methods of deciding how your customer segments differ, and though you certainly want to protect the privacy of users, it is often helpful to group customers based on behavior rather than metrics like location. It is for this reason that your Analytics account can sometimes be more frustrating than inspiring.

Custom metrics in Google Analytics

Want a workaround? Here you go:

The use of custom variables is a great way to categorize the types of users based on specific interactions on your website. Take, for example, a DEG client with a B2B sales model who is attempting to track various categories of users based on their interaction with a SharePoint site. Their goal is to ensure that their customers have the tools they need to drive their own growth in the marketplace. Because SharePoint analytics cannot track visitor paths and Google prohibits tracking at a user level, we created a custom variable solution to get the client information on their various user roles. Below is an example of the code we implemented:

 

$(document).ready(function() {

var role = $('.roleEmbedContainer').text().trim();

_gaq.push(["_setCustomVar", 1, "Role", role, 1]);

_gaq.push(["_setCustomVar", 2, "Role", role, 2]);

_gaq.push(["_setCustomVar", 3, "Role", role, 3]);

});

 

This script is called and loaded on every page load using the SharePoint master page and allows each user’s activity on the site to be evaluated based on the current role of that individual user. This process in its entirety also includes the population of a hidden element for the role using server-side C#, which then fetches the javascript listed above and sends the information to Google Analytics.

The script is called three times based on the different user-oriented scopes that allow users to gather information based on the page, session or visitor. The process followed for the script development and implementation can be found here.

The custom variables called out can be anonymous (user is on site and not authenticated), Gold (user is on site and authenticated in SharePoint as a Gold Membership user), and Silver (user is on site and authenticated in SharePoint as a Silver Membership user).

We also implemented custom javascript to allow Google Analytics to track tabbed page activity on the client website. By default, Google Analytics does not tracked tabbed activity as unique pageviews because the URL is not unique from tab to tab. To remedy this, we created custom javascript to allow for event tracking across all tabs on the website. The script developed is shown here:

 

$('ul.ui-tabs-nav.tab-height > li > a').click(function() {

var page = $('li.accordionHeader:first > ul > li.current > a').text();

var label = $(this).text();

_gaq.push(['_trackEvent','Tabbed Content', page, label]);

});

 

Similar to the role tracking, this script is also loaded on page loads, but is stored in the page layout instead of the website master page. The script is called on each click event for the tabs.

So what kind of business impact does this have? By using custom variables in Google Analytics, we were able to effectively and cleanly segment an otherwise unknown user population. The knowledge of these different types of registrants allowed our client to more efficiently target their marketing campaigns for relevant users. Ultimately, this helps increase visibility into important product information and feature availability across the company and its customer base, allowing our client to improve their bottom line.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comments

  • Vivianne Costa

    Vivianne Costa

    4 years
    Reply
    Do you think this can be used in Google Tag Manager?