Skip to main content

Web Tracking Code

The web tracking code, known in English as Tracking Code, is a parameter that is generated manually or automatically and added to one or more HTML documents to review the behavior of website visitors and to allocate sales in Affiliate Marketing.

These special codes are part of the URL and are displayed through the browser. They can be created, added and analyzed with the help of web analytics software. The web tracking codes They are part of the web analytics but their use must always be carried out in accordance with current regulations since their abuse implies legal consequences.

600x400-Tracking Codeoweb-en-01.png

General information

The web tracking codes include items such as cookies, tracking pixels and data analytics, and provide the opportunity to review user behavior. These provide information on the access data of the web portal, the navigation paths of the users and many other KPIs.

To correctly integrate these codes, it is necessary to enter the HTML source code and the respective software such as Google Analytics, with an account that connects to the specific web portal. For each web portal, and thus for your HTML document, there should be only one web tracking code, regardless of the software used.


The tracking codes They are lines with numbers and letters that store information related to the visits that the web portal receives. They are caused and subsequently added to the source code of the web portal. This can be done with JavaScript code that opens when accessing the web. The client provides information such as the IP address, URLs visited or time of duration in the web portal of the server.

A Google Analytics tracking code looks like the following: UA-01234567-8. This line is added to the header of the source code of the web portal. You can also determine the type of follow-up: you can select between a occasional follow-up for a general analysis of the web portal, a specific analysis or a monitoring an online store.

Recently Google Analytics also offers the so-called universal monitoring, "Universal tracking", a version of occasional tracking, which contains a tracking mechanism cross channel and cross device tracking. From this dynamic, the activities carried out on different channels and on different devices can be reviewed.

On the other hand, it is essential to remember that if these are used tracking codes For Affiliate Marketing, the Google Analytics account should be connected to the Google AdWords account. In Affiliate Marketing, tracking codes offer a clear correlation between the affiliate and the seller, and facilitate accounting (Eg sales, clicks, visits or impressions). At the same time, with the tool Google Tag Manager you can create and control all the links in a web portal.


An example of untracked HTML code appears as follows:

  <title>example of a html file</title>
  Text of your website.

According to Google Support, an HTML code with a tracking code for the conversion appears as follows:

  <title>example of a html file</title>
  <body> Text of your website.
  <!-- Google Code for Purchase Conversion Page -->
  <script type="text/javascript">
  /* <![CDATA[ */
  var google_conversion_id = 1234567890;
  var google_conversion_language = "en_US";
  var google_conversion_format = "1";
  var google_conversion_color = "666666";
  var google_conversion_label = "Purchase";
  if (10.0) {
  var google_conversion_value = 10.0
  /* ]]> */
  <script type="text/javascript"
  src="  conversion.js">
  <img height="1" width="1" border="0"  src="  conversion/1234567890/  ?value=10.0&label=Kauf&script=0">

Relevance in practice

The use of tracking codes It has been debated for a long time because the information obtained can sometimes exceed the protection of user data, among other things.

A final law with clear guidelines has not been agreed at the global level. For example, in Spain it has not yet been specified how IP addresses can be used. The question depends on whether the IP address is considered part of the personal data or not. One opportunity to avoid this is to determine your IP address as anonymous. If a website uses tracking codes, your users should be informed and, depending on the method used and the data they collect, a written chapter must be dedicated in the legal note. Decidedly, it should be remembered that it is not known exactly whether with these measures this is considered totally legal or not.

Relevance for SEO

To properly use thetracking codes knowledge of HTML, JavaScript and SEO is required. The creation and incorporation of these codes is especially complicated. There are websites where it is explained point by point how to generate and use these codes. The tracking code it should be chosen based on the type of web portal. For example: for online stores that want to generate sales, an e-commerce tracking should be used and for landing pages that want to generate visits, fixed objectives.