Articles in this section
Category / Section

Event Tracking Guide

After adding the Tracklution Main script to your website, you can start tracking events.

Make sure the main script is always loaded before any event scripts! Otherwise the event scripts won't work and Tracklution will not register events.

You will need to add the code to the relevant pages on your website. For example, if you want to track a "Purchase" event, you will need to add the code for the "Purchase" event to the purchase confirmation page on your website which will trigger the "Purchase" event.

Event types

Standard Events

Event type
PageView
ViewContent
AddToCart
CompleteRegistration
StartTrial
Subscribe
InitiateCheckout
Lead
Purchase
ContactInfo

Custom Events

On top of the above mentioned Standard Events, you can use any Custom scrips also. Just change the event name in the script to match the event name you prefer using and install the script in the desired location or action on the site.

<script>
    tlq('track', 'CustomEventNameHere');
</script>
These code snippets need to go in the <body> tag of your website.

Purchase Event

The Purchase event is used to track a purchase on your website. The "Purchase" event also needs a third parameter which is an object containing the purchase data.

The values for "value" and "currency" are just examples and for demonstration purposes. You will need to pass the correct, actual values for your purchase to these fields on your website's code.
<script>
    tlq('track', 'Purchase', {value: 2.25, currency: 'EUR'});
</script>

Partial Purchases or Virtual Purchases

This is useful if you wish to track virtual purchases or your business model includes multiple purchases happening within one session.

Tracklution will gather all partial purchases and calculate them together, and pass them on to Connectors as a single Purchase.

Partial Purchases collected within a session can be overwritten with an actual Purchase (Purchase that does not include ´isPartial´ setting).

Use case example 1:

You want to provide additional Purchase signals to Ad platforms of users that have shown valuable actions in the site but who do not finalise actual purchase.

This could be for example a user that spent a lot of time in the site and gathered products to shopping cart, but never finalised the purchase. Another good example is to set a Partial Purchase for a customer that subscribes to Newsletter, because you can later reach and convert the user via direct marketing.

We would like to tell to Ad platform that this was still a fairly good visitor (compared to visitors who do not perform any valuable actions).

We can set a Purchase event with partial Purchase that captures e.g. 5% of the shopping cart value:

<script>
    tlq('track', 'Purchase', {value: 5%ofShoppingCartValueHere, currency: 'EUR', isPartial: true});
</script>

Tracklution gathers this partial Purchase information and waits if actual final Purchase happens.

  • If there is no final Purchase, Tracklution will send this partial Purchase to ad platform to provide additional signals of engaged users.
  • If the final, real Purchase happen, this partial Purchase is overwritten and the actual Purchase with actual value is sent forward and partial Purchase is ignored.
Use case example 2:

Users are making multiple purchases within one session. Tracklution can gather all these purchases and send forward to Connectors as one Purchase (some Ad Platforms only receive one Purchase per session, so in case of multiple Purchases, part of the Purchase value would be lost).

Fire this tag always when partial Purchase happens:

<script>
    tlq('track', 'Purchase', {value: PartialPurchaseValueHere, currency: 'EUR', isPartial: true});
</script>
Tracklution will gather all partial Purchases within the session, calculate them together, and send forward as one Purchase event to Connectors.

ContactInfo event

The ContactInfo event has these parameters:

  • "set"
  • "ContactInfo" (the type of event)
  • an object containing the contact information (email, phoneNumber, firstName, lastName)

To send ContactInfo type event to Tracklution, you need to add the following code to your website's HTML code on the pages you have contact information available on:

<script>
    tlq('set', 'ContactInfo', {
      email: 'example@email.com',
      phoneNumber: '+358501234567',
      firstName: 'David',
      lastName:'Smith',
      birthday: '1985-06-17'
      gender: 'male',
      address: 'Street 1',
      postCode: '11015',
      city: 'Berlin',
      country:'Germany',
      externalId: '123-91197003219'
    });
</script>

The example above includes all parameters that can be passed with ContactInfo tag. You can freely choose which parameters to implement, just remove the ones from the script you wish not to implement.

You need to set the appropriate values to your ContactInfo event! The values here are just placeholders for demonstration purposes. 

In Google Tag Manager, the tag looks like this when you select the Data Layer Variables instead of using the placeholders:
datalayervariables

Data hashing for ContactInfo

Tracklution will automatically take care of connector specific formatting, and hashing the data (SHA-256) before the data is forwarded to your connectors.

Data hashing before sending to Tracklution

If you instead wish to hash data yourself before sending it to Tracklution, you will need to format the data before hashing. And, you will need to send an additional variant of the phoneNumber and email parameter, as different formats are used by different connectors.

The formatted and hashed data can then be implemented the same way you would implement non-hashed data, for example instead of  "email: 'example@email.com' ", you can insert hashed value:  "email: 'hashedValueHere'".

Parameter formats before hashing

Parameter Name:Value Formatting:
email
Trim whitespace, convert to lowercase, remove leading/trailing spaces.
emailVariants
(Microsoft Ads)
Trim leading/trailing spaces, lowercase the email, remove the “+…@” tag, remove periods before “@”, ensure it contains “@” and a dot after it, remove any remaining spaces, ensure it doesn’t start or end with a period, and strip accents.
phoneNumberInclude the plus sign, country code, and the phone number digits. Trim other symbols, letters, and any leading zeros.
E.g. +447911123456
phoneNumberVariants
(Facebook Ads, Snapchat Ads)
Include country code and the phone number digits. Trim the plus sign, other symbols, letters, and any leading zeros.
E.g. 447911123456
firstNameTrim whitespace, convert to lowercase, remove leading/trailing spaces.
lastNameTrim whitespace, convert to lowercase, remove leading/trailing spaces.
birthdayFormat as YYYYMMDD
genderm/f
addressTrim whitespace, convert to lowercase, remove leading/trailing spaces.
postCodeUse lowercase with no spaces and no dash. Use only the first 5 digits for U.S. zip codes. Use the area, district, and sector format for the UK.
cityLowercase only with no punctuation, no special characters, and no spaces. If using special characters, the text must be encoded in UTF-8 format.
countryUse the lowercase, 2-letter country codes in ISO 3166-1 alpha-2.
Connector specific formatting documentation
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied