Creating a variable
Home and general data
After accessing Data Manager’s “Variables” environment, you can start creating your configuration. Variables allows you to retrieve information from a data source (hit, URL, etc.) Simple processing can be applied to these variables (parsing, deleting, adding a string, etc.). They can be used later to edit or exclude a part of the data retrieved by tagging.
Types of variables
Each variable you create must be defined as either alphanumeric or numeric.
It is very important to select the right type from the start, because when you use a simple variable in a conditional variable, specific processing operations will become available based on the selected type. For example, you can use numeric filters (higher than, below than, etc.) for variables that are defined as numeric.
Status
Once a variable has been created, you must define its status. There are four status types available, each with a different functionality.
A variable with the status “In development” is in the process of being created. This variable can still be edited and used to test a processing operation. This is the only status that allows you to edit the variable.
The “Pre-release” status indicates that you have tested and intend to release the variables. This is usually a temporary status.
The “Released” status indicates that the variables are currently active on your site.
The final status, “To be deleted”, allows you to delete a variable that has not performed as expected during testing. If the variable was in “In development” status, it will be deleted. If it was in “Released” status, a new release is required to completely delete the variable.
Folders and additional information
You can use folders in Data Manager to help you organize your variables.
Your list of folders can be accessed through the menu on the left-hand side. By clicking on one of them, you can filter your variables and view only those that are stored within a certain folder. You can also create new folders by clicking the “New Folder” button.
To place a variable in a folder, you can simply drag and drop it into the folder or open the information on a variable (by clicking on its name or on the gear icon at the end of the line) and select a folder in the corresponding drop-down menu. Please note that a variable can only be placed in a single folder.
Simple variable
A simple variable allows you to retrieve information from a data source (hit, URL, etc.) Simple processing can be applied to these variables (parsing, deleting, adding a string, etc.).
Creating a variable is a two-step process. You must first select its source in order to define what it will be based on. Next, you can customise the variable (by adding or removing characters, for example).
Selecting the source
In order to use a variable, you have to specify the data source on which it is based. There are six different kinds of data sources.
The Hits source corresponds to the data sent by the Piano Ananlytics tag from a site. To understand how a hit is formatted, you can review our online documentation, especially the article “Building Your Hit” at https://developers.atinternet-solutions.com/general-en/craft-your-hit
Let’s consider the following hit as an example: https://logs.xiti.com/hit.xiti?&p=maison::electromenager::cuisine::page_cuisson&s2=45
If you want to create a variable with the page name, you have to retrieve the parameter p, as explained in the documentation. In order to do this, select the Hits data source in Data Manager and then select the parameter in the drop-down menu.
Tip: The drop-down menu only contains parameters that have already been received and processed once. If you can’t find the desired parameter, you can enter a custom value.
The URL source allows you to retrieve information from the site’s URL.
The Query String source allows you to retrieve parameters from the Query String of a site’s URL.
Using the following URL as an example: http://www.mysite.com?param=1¶m2=value .
The section before the question mark (in red) is the page URL. The section after the question mark (in green) corresponds to the Query String.
If you wish to retrieve the value of param2, this must be configured in the first step, when selecting the parameter.
The Referrer source allows you to retrieve the URL of the previous page.
The User Agent source allows you to retrieve the User Agent of the browser used during a visitor’s session.
The Custom Object source is specific to Piano Ananlytics. It allows you to retrieve a specific parameter from a hit: STC. This setting allows you to send whatever information you wish, without being restricted to Piano Ananlytics’s formatting.
For app analytics, for example, we use an object dedicated to this operation in the following form: {"lifecycle": {"fs": 0,"fsau": 0,"scsu": 2,"fsdau": 20160120,"dsu": 0,"sc": 5,"fsd": 20160120,"dslu": 0,"dsfs": 0,"sessionId": "e1e04f45-8d54-4e24-81cf-75314a5bcead"}}
In this case, if you wish to retrieve the sessionID, you would set ‘lifecycle.sessionID’ as a parameter.
In other words, the lifecycle object is in the first level, while the sessionId object is in the second level. The period allows us to outline the hierarchical structure.
Processing rules
Once you have selected the source, you can start performing operations with the variable. There are five kinds of processing operations.
Parse and store: This type of operation allows you to select part of the value being processed and store it.
Using a processing operation performed on the following URL as an example: http://www.mysite.com/category/subcategory
Let’s assume you wish to retrieve the category from the URL. We know that the category will always be at the first level on this site, after the domain name. This means that we can rely on the character separator slash (' / ') to retrieve the desired information. Starting at the beginning, the name of the category will always be the fourth element.
Tip: use the Test section on the right-hand side of the interface to check whether the variable you are creating does indeed retrieve the desired value. This feature is available regardless of the status of the variable, even if it is “In development” and has not been saved yet.
The “Parse and Delete” operation works similarly as the previous one, but allows you to delete an unwanted element.
The “Delete” operation allows you to specify the number of characters you’d like to remove at the beginning or end of a string.
The “Replace” operation allows you to edit the value that you are retrieving. You can use it to translate the names of certain pages, for example. The correlation table makes it easier to replace multiple values.
The “Add a String” operation allows you to add characters at the beginning or end of the values being retrieved.
Conditional variable
A conditional variable allows you to create specific processing operations based on specific conditions. These variables are based on previously defined simple variables.
Conditions
After you’ve created simple variables, you may need to create variables with certain conditions to meet more complex demands.
You can create up to 10 conditions, and each condition can contain up to 5 steps. It is important to note that these steps are verified in sequence, one after the other.
You can also use a correlation table to assign a certain value to your variable. If the key does not match anything in the table, you can choose to maintain the key’s original value.
Tests
When creating a variable, you can always use the Test panel on the right-hand side of your screen.
It allows you to check if the sequence of actions outlined for a variable does indeed produce the desired results. This tool allows you to see exactly where an error has occurred, if need be.