Custom dimensions and metrics in Universal Analytics

    The ability to use “custom dimensions and metrics” came with the new version of Google Analytics. If earlier, in the already classic version of Google Analytics, we were given the opportunity to manipulate 5 user variables, now in Universal Analytics we can use up to 20 user parameters and indicators.

    For the convenience of working with the material, I divided it into blocks:
    • 1. What are custom dimensions and metrics?
    • 2. For what purposes can custom parameters and indicators of Universal Analytics be used?
    • 3. Limitations of the use of custom parameters and indicators.
    • 4 .Sozdanie custom dimensions and metrics.
    • 5. Setting the values ​​of user parameters and indicators.
    • 6. Work with custom dimensions and metrics in Google Analytics reports.


    What are custom dimensions and metrics?

    If you explain in simple words, the parameters describe the characteristics of a certain object, for example, it can be the title or URL of the page.

    Custom metrics convey values, such as: the conditional value of a site page in points.

    For what purposes can the custom dimensions and metrics of Universal Analytics be used?
    1. • you can use them to transmit information to Google Analytics that is not in standard reports;
    2. • Custom dimensions and metrics are used in Google Analytics features such as data extension and cost data import;
    3. • they allow you to tag visitors, and then analyze the behavior of various user groups, for example, those who are registered on the site, and those who did not go through this procedure.


    This is not an exhaustive list of possible options for using the parameters and indicators that you can create yourself.

    Limitations of using custom dimensions and metrics .

    In the classic version of Google Analytics, you can use 5 custom variables, in the version of Universal Analytics, up to 20 custom parameters and indicators. If you are a Premium user, you can create up to 200 of your own parameters and indicators.

    Please note: 20 and 200 are the total number of parameters and indicators. That is, you can create 15 parameters and 5 indicators (a total of 20), but not 20 parameters and 20 indicators (a total of 40).

    The limit is set for each resource.

    Create custom dimensions and metrics.

    In order to create a custom parameter or indicator, you must go into administrator mode, select the desired (from the available) resource, and then find the item “User Definitions” in the menu:



    Then select the desired value: parameter or indicator (depending on what you are going to create). After selection, a page will open on which all parameters or indicators previously created for the resource will be displayed:



    Available parameters and indicators of Universal Analytics

    To create a new record, click on the red button at the top of the table:



    A form will be displayed in which you need to fill in the "Name" field (it will be used in reports), and also indicate the scope of the parameter or indicator:


    Creating a Google Analytic s parameter

    If you are not familiar with the scope of parameters and indicators, I recommend that you familiarize yourself with the official documentation (in English).

    If it is difficult for you to understand the principle of work of hits, sessions and user level, then I will try to open this topic a little.

    In Google Analytics, everything is built on hits. A single pageview, an event on a site, a transaction, a social action, etc. are all called hits . For clarity, let's call it "your step."

    Session- this is a set of hits that are performed until the session is interrupted, i.e., until 30 minutes of user inactivity have passed (default time). Up to this point, the session is considered active. For clarity, these are your steps (hits) from the first step (hit) to the final (hit). After 30 minutes you have taken a step (hit): the second path has begun (new, second session).

    The user level is all the hits and sessions of one user: these are all your steps (hits) and paths (sessions) while you can move.

    About how values behaveset for parameters and indicators at various levels is rather informatively displayed in the illustrations in the official documentation. I advise you to deal with this so that later questions do not arise: “Why do some values ​​turn out to be“ wiped out? ”

    Setting values ​​of user parameters and indicators.

    Once you have created the parameters and indicators you need, they need to start assigning values. You can do this in various ways:
    1. • through the tracking code;
    2. • using Google Tag Manager;
    3. • using the Measurement Protocol.


    Let's look at each of these options.

    After you create a new parameter or indicator in the Control Panel, you will be offered a code to be placed on the pages of the site or in the application:


    Example code for setting the parameter value

    This is the first way to set the value (via the tracking code). It can also be implemented using two slightly different methods .

    Option 1 . Setting the value of a user parameter or indicator when sending hit data (viewing a page, event, etc.). Implementation Example:

    // передача значения при отправке данных о просмотре страницы 
    ga('send', 'pageview', { 
    'dimension15': 'My Custom Dimension' 
    }); 
    // передача значения при отправке данных о событии 
    ga('send', 'event', 'category', 'action', { 
    'metric18': 8000 
    }); 
    


    Option 2. Setting the value of a custom parameter or indicator using the
    set method . Implementation example:

    1 // setting the value
    2 ga ('set', 'dimension5', 'custom data');

    In the second embodiment, the value is set for all hits that will be called after setting the value. For example, you set the desired value, and then the page viewing data is sent to the pages, and then the action is fixed. In this case, the value of the parameter or indicator will be transmitted both for viewing the page and for the event.

    If the first option is used, then the values ​​are transferred only for the hit where they are listed.

    A common mistake is to use the second option with setting the value via set (after calling the send method). Remember: setting any value through set must be done before send is called .

    Proper use:

    1 // setting the value
    2 ga ('set', 'dimension5', 'custom data');
    3
    4 // send event data
    5 ga ('send', 'event', 'category', 'action');

    Misuse:

    1 // send event data
    2 ga ('send', 'event', 'category', 'action');


    ga ('set', 'dimension5', 'custom data');

    The next way is to transfer data using Google Tag Manager. Use this method if you have implemented Google Analytics on the site using the Google Tag Manager.

    In order to indicate that when activating the tag the values ​​of the user parameter or indicator should be transmitted, when setting up the tag, click on the “Advanced Settings” block, then find the lines “Special Parameters” or “Special Indicators” and click on the desired one. Something like the following will be displayed :


    Creating parameters and indicators in Google Tag Manager

    Next, click the necessary button to create the parameter or indicator, specify the index and value:


    Example of setting a parameter in Google Tag Manager

    Where does the value for the "Index" field come from? It is assigned when creating a parameter or indicator in the control panel:

    Example of creating in Google Tag Manager

    As a parameter value, you can use a constant value that is entered in the corresponding field. In addition, you can specify the value of any available macro:


    Parameter value from the macro

    After the settings are made, the values ​​will be transmitted each time the tag is activated.

    The third way to pass values ​​is to use the Measurement Protocol or the Google Analytics Data Transfer Protocol.

    If you are not already familiar with this feature, I recommend that you familiarize yourself with it in this material .

    I will briefly dwell on this possibility, as there shouldn’t be any difficulties with its use (if something doesn’t work out, return to the description and principle of operation of the protocol itself).

    To indicate that the query contains parameters and indicators, use additional parameters with the names cdN and / or cmN , where N is the index assigned when creating the parameter or indicator.

    Example of a Measurement Protocol query sent using jQuery when a button with id = buttonId is clicked:

    1 $ ('# buttonId'). Click (function () {
    2 $ .post (
    3 " www.google-analytics.com/collect " ,
    4 {
    5 v: '1',
    6 tid: 'UA-xxxxx-1',
    7 cid: '12xx916x95.13x6127xx4',
    8
    9 t: 'event',
    10 ec: 'Event check',
    11 ea: 'Virtual',
    12
    13 cd1: 'Parameter value ',
    14 cm2: 3, // indicator value
    15 },
    16 onAjaxSuccess
    17 )
    18 });

    Pay attention to the line with the values cd1 and cm1 : they pass the values ​​for the parameter with index 1 and the indicator with index 2. You

    should also be aware that there is a limit to the parameter value of 150 bytes ( documentation)

    After the necessary parameters and indicators have been created, the values ​​are transmitted for them: you can start working with the collected data.

    Work with custom dimensions and metrics in Google Analytics reports.

    You did a great job of creating and setting parameters and indicators, organized the transfer of the necessary values, but it will be useless if no one can work with the received data. Google Analytics has no problem with this. Your information is available both in standard reports and in custom reports.

    Work with standard reports.



    Use in advanced segments:




    Use in custom reports:




    Use in custom reports Google Analytics


    Also popular now: