Using Data Attributes

You are here:
Estimated reading time: 1 min

This article extend the knowledge given on the following article:

Using data attributes will further enhance your analytics when you work in the following scenarios:

  • Landing pages.
  • Custom Websites
  • Online Stores
  • Referral Promotional Sites
  • Single and Multi-page web applications.

Lets get started.

Including HTML data attributes

Data attributes are designed to define additional data pertinent to specific HTML element in your website or app.

You account’s data reader includes pre-defined data attributes that you can use to customize the data for certain elements that you see fit.

Triggering a data collection event

Any HTML element that contains the class “tgi_event” will trigger the data collector to relay data to your account.

For example:

<button class="tgi_event">
    Click button

Data Attributes

The following optional parameters can help you further enhance your analytics.

Event Type

This is the event type that helps you group events under one name.

<button class="tgi_event" data-tgi_type="click">
    Click button
Examples: “click”, “visit”, “submit”, etc.

Event Name

Here you can name your event to further

<button class="tgi_event" data-tgi_type="click" data-tgi_name="button">
    Click button

This helps you further identify an event from the rest.

Use this to tag different actions in the same page or component.

Examples: “Menu button”, “User registration submit”, “Store bundle 1”, “Share online”, etc.

Event Additional Text

This is the event type that helps you group events under one name.

    Click button

This helps you when you have very similar buttons or actions that need even more granular organization among your analytics.

This is very useful when you have a screen with multiple interactable menus, buttons and sections.

Examples: “Purchase now”, “See details”, “Home user profile logoff”, “Share on Facebook”, etc.
Was this article helpful?
Dislike 0