What are tracking scripts?

Our tracking scripts enable us to gather behavioral data from visitors. It also allows us to serve website touchpoints, such as notifications and embedded content. A tracking code is a small snippet of code that is usually implemented as JavaScript in the HTML source code of a website. These lines of code allow advertisers, web admins, and marketers to analyze the flow of visitors to websites and users’ activities. Tracking codes are an essential prerequisite for conversion tracking and attribution. Tracking codes should not be confused with tracking parameters attached to the URL.

Some knowledge of HTML and JavaScript is certainly helpful to use tracking codes effectively, as integrating the code and the tracking settings is usually a complex process.

The basic tracking script is required for Datatrics to function. In addition to the standard tracking script, there are also other recommended e-commerce scripts that can be placed manually, namely:

  • Conversion script

  • Product views script

  • Shopping cart script

Read this article if you want to know which scripts you need to add to your website.

Where to find the tracking and e-commerce scripts

The scripts can be found in the Integrations section on the platform. If you click below the integration called “Datatrics Tracker.JS” you will be redirected to a menu. Click “Edit” here at DatatricsTracker.

At the bottom of this page, you can find the tracking script, conversion script, product views script, and shopping cart script. Note: To view these scripts, you need to click on these modules.

Basic tracking script

Before you start creating journeys, segmentation, and campaigns, it is important that Datatrics reads website traffic. This is done using the standard tracking script that must be placed on the website on every single page. The Datatrics tracking script is used for:

  • Tracking website events

  • Placing Datatrics content

  • Deciding the buying phase and other predictive values based on the Datatrics algorithm

  • Gathering user information (device, geolocation)

  • Sending custom profile data

This script can be placed in several ways. It can be added to the website hard-coded in the source code or via an integration such as Lightspeed or Shopify. Please note: we strongly advise against placing the tracking script multiple times, as this can hinder the functioning of Datatrics.

Check out this article to see the most fitting way to add the tracking script to your website.

If you’d like to read more about how Datatrics tracks visitors and in which way it loads on your website, check out this article.

Conversion script

Conversions can be sent to Datatrics using a conversion script. You can add custom conversions to Datatrics, for example, when someone visits your payment confirmation page, but much more data is gathered when you use a conversion script. When you use the conversion script, Datatrics can see the order ID, the items in the conversion, and if shipping costs are applied. So if Datatrics recommended an item to a visitor, it could see if the visitor actually bought that item later and if the recommendation was good. If not, machine learning will kick in and do better next time.

The conversion script can be placed hardcoded on your website. An easier way is to place enhanced e-commerce scripts via Google Tag Manager (GTM). Various integrations can also ensure that conversions are sent to Datatrics.

Check out this article to see the most fitting way to send conversions towards Datatrics.

Shopping cart script

Visitors’ shopping carts can be sent to Datatrics using the shopping cart script. This allows you to target profiles based on their interests, measure abandoned carts, and make special recommendations based on a visitor’s shopping cart.

This script can also be placed hardcoded in the source code on your website. Another way is to do this via an integration, such as the Magento 2 plugin. Lastly, you can also add it to your website using enhanced e-commerce scripts in GTM.

Check out this article to see the most fitting way to send carts towards Datatrics.

Did this answer your question?