Google analytics account tracking id for youtube. Tracking ID and Property Number - Google Analytics Help

Greetings, friends! Our material today is devoted to web analytics and such an issue as obtaining a Google Analytics client id. Typically, this question arises when integration is required with various additional services, such as CRM systems, tracking mailings and offline activities.

We have prepared 4 real ways to do this, illustrated them, so all you have to do is read, choose one of the methods for obtaining the Google Analytics client id and do everything according to the instructions.

What is client id (CID)?

To better understand the issue, it would be helpful to explain what a client id is. In essence, this is a unique user (not a specific person, but for example a smartphone-browser combination), whose function is to store information about visiting the site. And at the moment when we need to send offline data to Google Analytics and associate it with a visit to our resource, we need to specify this key.

How it works? Let's imagine that you have a landing page and advertising is set up. Applications are received daily from the site, processed and then entered into CRM. After some time, some of them receive payment and in order to transfer payment data to Google Analytics and understand which ad or search phrase brought us income and in what amount, we need a client id

4 ways to get Google Analytics client id

1 way.

Install Universal Analytics (aka Google Analytics) on your website.

After that, by calling the following code, the clientId javascript variable will contain the value we need:

ga(function(tracker) ( var clientId = tracker.get('clientId'); ));

Method 2.
Using PHP, making a request on the server.
}

// Handle the parsing of the _ga cookie or setting it to a unique identifier

function gaParseCookie() ( if (isset($_COOKIE['_ga'])) ( list($version,$domainDepth, $cid1, $cid2) = split('[\.]', $_COOKIE[“_ga”] ,4); $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2); ]; ) else $cid = gaGenUUID(); return $cid;
3 way.
We get cid using JavaScript using the following code:
{
match = raw.match(/(\d+\.\d+)$/);
}
var gacid = (match) ? match: null;
if (gacid)
( return gacid;
}
}

4 way.
Google Tag Manager.

When using this service, you will need to create a new variable - ga cookie:

Secondly, we create a variable of the Custom HTML type - cid and write into it:
}

function() ( try ( var cookie = ((ga cookie)).split(“.”); return cookie + “.” + cookie; ) catch(e) ( console.log(“No Universal Analytics cookie found”) ; return "n/a"

Advertising on the Internet is becoming more expensive every year, and therefore requires more and more accurate analysis, including taking into account offline conversions. We have already written about how to track. Be sure to use the knowledge you gain and upgrade your internet marketing.

We had one email marketing platform, a bunch of subscribers and the need to set up end-to-end analytics in emails and on the website linked to the user profile. And that's how it ended.

We'll talk about a little-known Google Analytics feature called Measurment Protocol for email tracking. We'll look at how to properly set up a tracking pixel to track email opens in the GA interface, the number of subscribers who interact with you, and to analyze the email opening environment (mobile or web clients).


This article is an adapted translation of material from the FreshInbox blog.

Tracking pixel structure

The first thing that needs to be done is setting up your Google Analytics account: you will need a working tracking ID (usually looks like UA-XXXXXXX). If you don’t have any of this yet, you can read the instructions and quickly set everything up ☺

Then you will need to set up a tracking pixel in order to then add it to the code of the emails you send - it is with its help that you can transfer data from emails to your analytics account. The standard structure of a pixel based on the manual for its creation is as follows:

  • Http://www.google-analytics.com/collect?v=1&tid=UAXXXXXX&t=event&cid=123123123&ec=kinetic&ea=interact&el=unit1&cn=campaign_20160130&cs=email
  • cid - subscriber identifier, essentially session id or recipient id. This value must be unique for each subscriber in your database. You can use the email hash or subscriber ID in your mailing platform for this. The only thing is that it is strictly forbidden to transmit the email itself here, since Google prohibits using data for tracking that allows them to identify the user.
  • t — type of action to be tracked, should be set to event (type) to track events, not page views.
  • ec — event category. This parameter is used to group events; parameters such as email or kinetic can be passed here, as we will use later in the examples.
  • ea - event type, used for a more detailed grouping of types of events performed by the user inside an email, for example, for simple openings, tracking different email clients, or the fact of viewing an animation.
  • el is an additional event parameter (event label), used for even deeper analytics, for example, the type of opening device (web, mobile or email client) can be passed here.
  • cn - campaign name, just like campaign source, serves to identify a specific campaign in the email marketing channel.
  • cs - campaign source, required for campaign tracking.

Plus, of course, you can add your own variables, similar to UTM tags, and track the events or parameters you need. If you already have an established UTM markup structure, then it makes sense to consider it here.

We embed a pixel in the newsletter

Once you've configured all the pixel parameters, it's time to add it to your email campaigns. We will test several parameters for a dynamic email with an image carousel and a hover - changing the image when you hover the mouse over it.

Opening tracking

The simplest way is to track the regular opening of a letter; to do this, add the following code to the newsletter (it will work if displaying pictures in the letter is enabled):

Hover code: .img-swap:hover .tpixel( background-image:url(http://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX&t=event&cid=*|UNIQID|*&cn= test_campaign&cs=email&ec=kinetic&ea=interact&el=rollover )

True, this will not work everywhere. You can track hover mainly only in Mac Mail, Mozilla Thunderbird and some other email clients. In most web interfaces, you won't be able to track hover.

Code for an image carousel implemented via radio-button. Please note that for a carousel of three images, we set tracking only for the second and third - after all, the first is loaded by default.

Radio2:checked ~ .carousel .tpixel( background-image:url(http://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX&t=event&cid=*|UNIQID|*&cn=test_campaign&cs=email&ec= kinetic&ea=interact&el=radio2_select); .radio3:checked + .carousel .tpixel( background-image:url(http://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX&t=event&cid=*| UNIQID|*&cn=test_campaign&cs=email&ec=kinetic&ea=interact&el=radio3_select )

Here, as in the previous version, it will be possible to track only in some email clients, just as this carousel will not work correctly everywhere.

Mobile open tracking: @media screen and (max-device-width: 600px) ( .mobile-pixel( background-image: url(http://www.google-analytics.com/collect?v=1&tid=UA-XXXXXX&t =event&cid=*|UNIQID|*&cn=test_campaign&cs=email&ec=kinetic&ea=client-type&el=mobile);

Tracking of openings from mobile devices will also not occur in all mobile email clients, but only in standard ones: Mail (iOS) and mail on Android (up to version 5.0).

Pixel testing

Google Analytics is great because it allows you to get real-time statistics with minimal latency, so you can send yourself a test message or simply load the newsletter HTML code in your browser and see if the pixel fires.


You can get to such a report in the menu Real-Time -> Events, where you can also see, for example, the number of events in the last 30 minutes.

At the same time, you need to pay attention that when an event is opened, it is tracked only once; to reappear in the analytics, you need to reload the page with the open letter - this mostly applies to the hover, the statistics for which will work only once.

Reports

Now comes the fun part - viewing analytics for your mailings. Reports can be found in the analytics interface in the Behavior - Events - Top Events section (Behavior -> Events -> Top Events).

Once on this screen, you get statistics grouped by event category (ec). By then clicking on the category you need (kinetic in our case), you get this report displaying all the actions:


In the screenshot you see two indicators: Total Events and Unique Events, while the Total Events parameter is, in fact, the total number of downloads of the tracking pixel.

But please note that Unique Events is not the number of users who viewed the email, it is the number of sessions during which the event was triggered. For more information on how a session is determined, see

At the same time, counting the number of unique users who opened the letter or interacted with it in any way is also available. To do this, you need to go to the report settings mode and add a new indicator “Users” there; the video below shows how this is done:

Using the Google Analytics pixel, you can work with email statistics data without having to use the ESP interface, and you can also track the effectiveness of emails sent using your local mail server or services like Amazon SES and Sendgrid.

If you want to run a successful website, it is important to know your audience and what they expect from your site. The best option to achieve this task is to analyze your traffic. This is exactly what Google Analytics does. This is a free application from Google that allows you to track your website visitors, analyze their habits, traffic sources, social indicators and many other various data. By analyzing the statistics of your site, you can create the content your visitors need. In this tutorial, you will learn how to register and add a Google Analytics Tracking ID in WordPress.

Why is Google Analytics needed in WordPress?

Perhaps everything becomes much simpler when you know what your visitors want from you and your site? To keep them coming back to your site again and again, you need to provide them with what they want. This is exactly what Google Analytics does. Here are just a few reasons to add Google Analytics to your site and why every WordPress site should have it:

  • It helps in determining the behavior of your users.
  • Yes, you will be able to virtually track your users' behavior through Google Analytics. You can easily check the most viewed pages, the average viewing time of each page, and even determine which page is causing your users to leave your site. Of course, viewing this information will help you optimize your website. For example, if a certain article attracts a lot of traffic, you can publish more articles on similar topics and attract more traffic.
  • It helps you analyze the times with the most activity on your site.
  • You can easily determine the time period with the most traffic. For example, if most of your users are active at night, it is obviously better to postpone the publication of your posts to a later time.

  • It helps you in exploring important data.
  • Google Analytics can give you the smallest details - from where visitors are located, to the language they speak, from the browsers they use, to screen resolution and similar data. This will definitely help you understand your audience better.
  • While there are several other analytics services you can take advantage of, Google Analytics provides a wide range of exclusive features. Let's take a quick look at each of them:
  • These are just a few of the Google Analytics features that make working with WordPress a breeze!

    How does Google Analytics work?

    You might think that the data that Google Analytics provides is simply incredible. But how does he do it all? Well, basic knowledge about how the software works helps in using it more effectively. The Google Analytics process can be described in three stages:

  • JavaScript code.
  • When a user lands on your site, JavaScript begins to execute, which collects all the necessary information about the site itself and information about the visitor: the browser from which he entered, operating system, screen resolution, etc.
  • Data collection service.
  • Once the information is collected, it is sent to Google servers in the form of small packets called hits. These hits are sent every time a visitor opens your site.

    Data processing. While processing data, Google Analytics servers turn raw information into statistics that are useful to you. For example, they distribute your users based on their location, language, screen resolution, device type, and much more.

    That's exactly how it works. The whole process may seem very easy, however, most of the complex processes of collecting and generating information are hidden from view.

    I hope this only makes you more excited to add your site to Google Analytics. Here's a quick guide that will show you how to register and add your site to Google Analytics on WordPress.

    Before you start this guide, you will need the following:

  • Step 1 - Create a Google Analytics Account The first thing you need to do is create a Google Analytics account and get a tracking code. The steps below will guide you on how to sign up for Google Analytics: Go to the page
  • Google Analytics
  • . Click the Register button, which is located on the top right side.
  • You will be redirected to the login page. Enter your email address and click Next. If you don't yet have a Google account, create one by clicking on the Create an account button.
  • On the next page, enter your password and click Login.
    • Click the Register button to continue.
    • To create a new account you will need to enter the following information:
    • Account name.
    • Name of the site .
    • Website URL.

    Fill in all the required details and click the Get Tracking ID button. On the next page you will be asked to accept the License Agreement, click Accept.

    That's all! You have successfully created a Google Analytics account. You should now see the Google Analytics Universal tracking code:

    This code is the same for all sites. The only difference is the unique identifier (UA-00000000-1). Yours should be on the same page. The Google Analytics Tracking ID starts with UA, which stands for Universal Analytics, the first set of numbers represents the account number (00000000), and the last number represents the Google Analytics Property ID (1).

    Step 2 - Adding Google Analytics Tracking ID Code to WordPress

    There are several ways to add a Google Analytics tracking ID in WordPress: using a plugin, adding a tracking script directly to the header.php file, or creating a new function in the functions.php file.

    Option 1 - Using a plugin

    If you are not familiar with WordPress and PHP file structures, we recommend using this option. One of the best plugins for this is Analytics Code Integration. This plugin will add the Universal Analytics tracking code automatically - you just need to enter your Google Analytics account tracking ID.

    The steps below will show you how to install the plugin and add your Google Analytics Account Tracking ID:

  • Login to your WordPress dashboard and install the Analytics Code Integration plugin. Follow if you don't know about how to install a new plugin on WordPress.
  • Once the installation is complete, go to the Settings section and click on Google Analytics Code.
  • Paste your Google Analytics Tracking ID into the box and click Save.
  • That's it, the tracking code has been successfully added to your WordPress.
  • Please note that it takes 12 to 24 hours for Google Analytics to update and begin showing the first results. After this, statistics about your audience will be presented in the Google Analytics Reports tab.

    Option 2 - Adding code to header.php

    As previously written, there are several ways to add Google Analytics code to a WordPress site. For example, the code could be added to your theme's header.php file:

  • Log into your WordPress admin panel and go to Appearance → Editor.
  • Open header.php for editing.
  • Paste the tracking code you received in Step 1 before the closing tag and click the Update File button.
  • THE NOTE!

    Option 3 - Create a new function in functions.php file

    This method requires basic programming knowledge and we recommend using it only if you fully understand your actions. Additionally, it is strongly recommended to create a backup of your functions.php file or even your entire site:

  • Log into your WordPress dashboard and go to Appearance → Editor.
  • Select functions.php from the list of files on the right.
  • The following snippet will create a new function and insert the Analytics code along with the tracking ID right before the closing tag on your WordPress site. Paste this code at the end of your functions.php file, don't forget to change the tracking ID to yours.
  • add_action("wp_head","my_analytics", 20);