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).

  1. 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 AT Internet 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/generalites/construire-votre-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&param2=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 AT Internet. 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 AT Internet’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.

 

  1. 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.

 

 

Have more questions? Submit a request