August 2016
Workshop: transmitting user parameters offline
11 August 2016, 16:10

Let's continue our discussion about working with user parameters. Last time we went into detail about how to transmit data online and in this article we will talk about uploading it offline. This method lets you add information that you already have in your database (such as customer income or loyalty status) to your reports.

In order for Metrica to determine which visitor should have these new attributes, data from your base needs to be linked to Metrica data by assigning them the same ID. This can be done either by sending Metrica your own customer IDs (UserID) or by entering unique visitor numbers from Metrica (ClientID) into your CRM.

Matching based on UserID if you have your own customer identifiers

Stage 1. Teach Metrica to recognize customers

To start transmitting your own authorized user IDs (UserID) to Metrica, you need to add code on your site that will insert these IDs into the setUserID method:


UserIDs will not display in reports; they are saved in the Metrica database as keys that allow Metrica visitors and your CRM customers to be matched. Every time an authorized visitor visits your site, Metrica receives a command to "remember" that visitor using their UserID.

This match will be made for all your registered visitors after they visit your site at least once under their username. This process may take some time: it depends on how often your customers return to your site.

UserID can be sent for non-authorized visitors as well. You can also get unique IDs from "tagged" links that you send to your customers via email or social network referrers. Discount card numbers or promo codes that the visitor enters on your site can also be used as UserIDs.

Stage 2. Upload data

After sending Metrica enough UserIDs, you will need to prepare a file with the customer attributes that you want to add to your reports. This table should be in csv format with three columns. The first contains UserIDs, which will be used as keys to link data in your file to Metrica data. The second will contain parameter names and the third is for parameter values.

Here is how that type of file looks:

To send this file to Metrica, go to the Upload Data tab in the counter settings. Don't forget to choose the file type  — UserId:

After the file is processed, you will see this notification in the interface:

Status: Completed (80% match). This means that the UserIDs you transmitted were found in Metrica for 80% of the customers in your file. Usually the data can not by completely matched up because not all customers visited your site, which means that you haven't transmitted their UserIDs yet, and Metrica doesn't know which visitors it should assign the attributes in your table to. So parameters will only be added for the 80% of visitors that were matched. It's important to keep this in mind when you look at your report data.

☞ Metrica can store up to 1000 parameters for a single visitor.

Matching by ClientID when you don't have your own visitor IDs

A ClientID is a number that Metrica assigns to every visitor. It can be used as a key to link data if your site doesn't have its own identification system or if customers rarely register online (because, for example, they place orders by phone).
To get ClientIDs from Metrica, add code that calls the getClientID method to your site and record the value you get to your CRM:

<ClientID> = yaCounterXXXXXX.getClientID()

After some time has passed and enough visitors have been to your site and gotten ClientIDs, a csv table of customer attributes can be generated. It will look the same as in the UserID example, only this time the first column will use ClientIDs as keys that match visitors. And you need to choose the ClientID file type when you upload a table to Metrica.

How to update or delete uploaded data

All you have to do for reports to start displaying new parameter values is upload a current file. If you want to delete data, you need to go to the same data-upload menu, select Delete and transmit a file with empty parameter values:

Uploading this type of file doesn't set parameter values to zero; it deletes them. In other words, if you transmitted the number of purchases per client and then uploaded an empty file, the offline-purchase parameter would just disappear from your reports rather than have a zero value.

Is it better to transmit visitor parameters online or offline?

With the userParams method, it makes sense to send data that only relates to online behavior and doesn't need to be stored in your own database. This way also works for internet publications or blogs that don't have CRMs.

The two approaches also differ by the speed of data updates in reports. When you get the setUserID or getClientID method up and running and the majority of your customers have visited your site at least once, new data will show up right away in reports as soon as you upload a current file (rather than waiting until the customer returns to your site.

You can find answers to frequently asked questions regarding both ways to work with visitor parameters in this article.

No comments
user parameters
User parameters: answering your questions
12 August 2016, 19:20

In wake of our user parameters workshop, we put together a list of the most frequent questions we received concerning the two ways to transfer data: online and offline.


— Which way is better — online or offline?

It depends on the type of data you want to work with. Online data transfer works best for information that only "lives" online and doesn't need to be stored in a CRM (such as certain aspects of how visitors use your website). In some cases though, it's still useful to note this "online" information in your own database and then send it to Metrica from there.

For example, if customers can get a discount card on your site, you'll want to note that certain customers have this card in your database.

The two methods also differ in speed. Offline uploading lets you add data for visitors that already have UserIDs/ClientIDs faster: parameters will update immediately when you upload the current file. By contrast, you will have to wait for the customer's next visit to your site to send data using the userParams method.

If necessary, you can transfer data using both online and offline means.

— What's better, a UserID or a ClientID?

This depends on whether or not you have your own unique customer IDs. If you do, then it's simpler to use UserIDs and not involve an extra ID system.

— Can I use different ID types simultaneously for the UserID (such as username and social network referrer)?

You can only choose one ID type for the UserID. Otherwise different UserIDs will be transfered to Metrica for the same visitor and that individual's parameters will be matched with several different visitors.


— I get a "matching error" when I try to upload my file. What should I do?

A matching error means that you either haven't added the code that calls the setUserID or getClientID methods to your site or this code is not functioning correctly. You might also be getting this error because no visitors that you transfer UserID's for or get ClientID's from have visited your site yet.

— Is it necessary to get a 100% client match when uploading a file?

In actual practice, 100% matching doesn't happen: sometimes a customer's data doesn't "stick together" due to small technical kinks (for example, like when a visitor leaves a site before the counter code loads).

If you've got any other questions about user parameters, just ask away in the comments – we'll be happy to help.

No comments
user parameters