How to configure Google Analytics to track user behavior by User ID

    In the work of EastBanc Technologies, the task often arises not just of analyzing statistics of attendance and behavior by geographical, platform and demographic characteristics, but according to the principle that a specific user on the portal does in great detail. For us, as developers of enterprise systems, this information is critical from the point of view of system development.

    For example, now we have in our work a SharePoint-portal, which is used for remote settlement and financial services of contractors of the customer company. Each counterparty has several users - from 1 to 10. We wanted to understand how they handle this or that functionality. To describe their behavior for ourselves, we used the Google Analytics tools.

    Why didn’t we interview the focus group? In our experience, surveys are useless, as a result you always get distorted information, because a certain percentage of people can get off unsubscribing, dramatize, or, conversely, put everything in a more rosy light, and finally, just unmotivated to lie (and that, it happens :)). A precisely tracked chain of user actions on the portal is what gives objective, relevant, useful information. Good analytics also helps to evaluate different groups of counterparties in different ways, among which there are both large enterprises and very small ones, and it is impossible to level them out under one comb.

    Limitations

    As you know, Google prohibits the storage of data that can uniquely identify the user.

    We quote the user agreement:

    7.PRIVACY. You will not (and will not allow any third party to) use the Service to track or collect personally identifiable information of Internet users, nor will You (or will You allow any third party to) associate any data gathered from Your website (s) (or such third parties 'website (s)) with any personally identifying information from any source as part of Your use (or such third parties' use) of the Service. You will have and abide by an appropriate privacy policy and will comply with all applicable laws relating to the collection of information from visitors to Your websites. You must post a privacy policy and that policy must provide notice of your use of a cookie that collects anonymous traffic data.

    To overcome these limitations and expand data for a more comprehensive analysis, Justin Cutroni, Analytics Evangelist at Google, suggests adding a user ID to Google Analytics .

    In fact, it is proposed to identify the user with a unique GUID, then use Data Query Feed to upload data to your system, compare one-to-one correspondence with users and build analytics on your own.

    The big and most important “but” of such a decision is difficult, expensive and inconvenient. Obviously, implementing something like Google Analytics to view reports on your side is not easy, and is simply an inefficient waste of money.

    Decision

    That is why, we began to look for a different way, and as a result the following happened:

    1. All contractors are identified by the contract number or number in the accounting system, all users are equated to it. Thus, it is possible to identify users using this number, which is not personal data.

    2. By default, the visitor variable is selected .

    Any analytics can now be carried out in the context of all users, contractors. To do this, on the Google Analytics pages in sections that require filtering / grouping / adding to the display, you must select the option My variables-> My variable (value 01).

    In addition, we divided the users by language and divided the contractors and employees of the customer company. Tracking by language is automatic due to the choice of a standard way to set the user's location.

    The division into users into counterparties and employees of the customer company occurs using the “user token”:

    authenticated = Tools.IsUserIdentified(out agencyCode);
    marker = authenticated ? (agencyCode ?? "Работник"):"Анонимный";%>
    Инжектим этот маркер в мастер-страницу:
    _gaq.push(['_setCustomVar', 1, 'Пользователь', '<%=marker%>', 1]);
    


    Thus, we look at an attempt to authorize the user and get / do not get the counterparty code. If you are not authorized, consider it as an anonymous; authorized, but the agent code did not return - as an employee; counterparty code returned - this is the counterparty.

    3. Added page level tracking. In each master page of our SharePoint portal, we have added code that tracks this variable:

    _gaq.push(['_setCustomVar', 1, 'Пользователь', '<%=marker%>', 1]);
    


    4. Added tracking on the damage of WCF services: we attached counterparty codes to viewing pages, but within one page the counterparty can perform many actions. Calls to WCF go through a special layer of services. Until now, this has given us two advantages: we don’t need to copy the cumbersome code for organizing ajax calls and we can do error handling in a single style due to an error handler in the base class. That is, the code that needs the data is not contaminated with small technical details.

    Through these services, we placed tracking events in case of successful completion of a call. All this works on promises, therefore, introducing this functionality into the service did not require any changes in the consumer code.

    We have created the following custom categories and types of events within the category (this is done according to the GA standard).

    List of categories:

    a. MakeToDo
    b. Currency Rates
    c. Dashboard
    d. Payments
    e. Accounts.

    List of events that we are tracking:

    a. View List
    b. View Object
    c. Delete object
    d. Modification of an object
    e. Download file
    f. Acceptance of payment document
    g. Cancellation / restoration of an account.

    (Recall that this system, which we consider as an example, regulates the settlement and financial relations between counterparties and the customer company, this determines the names of categories and events).

    Take for example one event:

    getDocumentsList = function (data)
        {
            return dispatcher.call(
                {
                    method: ETR.HttpVerb.POST,
                    data: data,
                    relativeUrl: serviceRelativePath + '/documentsList'
                })
                .fail(dispatcher.faultHandler)
                .done(function ()
                {
                    ETR.gatc.track(ETR.gatc.categories.JustificationDocuments, ETR.gatc.actions.ListBrowsing);
                });
        };
    


    5. In order to see what agents what actions and to what extent were performed on the portal, you need to go to the Behavior-> Events-> Events map section and select My variables-> My variable in the green drop-down list (value 01 ) We’ll get about the following picture:

    Clickable image
    < ">

    What we got as a result:

    1. We track visits to all pages of the customer’s financial settlement system.
    2. Analytics, among other things, is conducted in the context of languages ​​(now there are two of them - Russian and English).
    3. Analytics is carried out in the context of counterparties. In order to see the history of visits, go to the Personalized-> Variables section, there we see the Users section. Having entered it, we see approximately the following picture:


    Clickable image
    < >

    Analytics is carried out primarily by contractors. Also, anonymous users and employees of the customer company go as separate items.

    Why was it important for us to get a solution that allows us to accurately assess how users behave on the portal? Because it is important for us to understand whether the people we created use the interfaces, modules, business processes as intended.

    And do not forget about another important factor: for the proper setup of Google Analytics, we spent a very reasonable time and effort using completely standard tools. Everything as we love :)

    Also popular now: