Google Analytics

This plugin supports tracking views of the legacy<Personalize> Ninetailed SDK component, but does not track views of the <Experience> component designed to support experiments. Additionally, this plugin handles properties in a way aligned with Universal Analytics that is soon to be sunset; Google is replacing these properties as part of a new event paradigm in Google Analytics 4. See the GA migration documentation for more information about changes to events.
For these reasons, we strongly recommend that you use the Ninetailed Google Tag Manager with your own GA custom event trigger instead of this plugin. The GTM plugin supports both experiments and the new event paradigm of GA4.

What Is Google Analytics?

Google Analytics is a web analytics service that provides insights about traffic across various platforms, and how users interact with these platforms. It offers real-time data that can be used to track marketing campaigns, assess application performance, and understand customer behavior.
Additionally, Google Analytics measures conversion rates, revenue, and other metrics for various businesses.
Google Analytics provides you with conversion rates, revenue, and other metrics to measure the success of your e-commerce business or B2B saas model.
All of this data can be accessed through the Google Analytics dashboard, which makes it easy to monitor application performance and identify areas for improvement. Overall, Google Analytics is essential for any business that wants to understand its online customers and improve its user experience (UX).

Install the Analytics Package

To set up Ninetailed to send Google Analytics data, you need to install the @ninetailed/experience.js-plugin-google-analytics package.‌
npm install @ninetailed/experience.js-plugin-google-analytics
yarn add @ninetailed/experience.js-plugin-google-analytics

How to Use

The base Google Analytics tracking script must already be installed on your site for this plugin to function. See the Google Analytics tag install instructions.
Import the following library into your code:
import { NinetailedGoogleAnalyticsPlugin } from '@ninetailed/experience.js-plugin-google-analytics'
Then, instantiate the plugin on the Ninetailed provider:
// ...
new NinetailedGoogleAnalyticsPlugin({
actionTemplate: 'User has seen personalized component:{{}}',
labelTemplate:'{{ baselineOrVariant }}: {{ component.__typename }} - {{ }}',
//... Your Application Components

Plugin Parameters

This is a unique field required by the Analytics tool, to collect data inserted on your platform.
Defines categorization for events

The actionTemplate

Google events include two required properties to track user interaction on websites which include:
  • Event Category: This is a name given to a group of similar events you want to track.
  • Event Action: This is a name assigned to the type of event you want to track for a particular web page element.
The event Action, by default, is set as Ninetailed but you can create your custom assign your event name using the actionTemplate property which is templated String.
The category is "Ninetailed” and can’t be changed

Check Connection

If you successfully connect Google Analytics to your platform, the following parameters in the image below should be noted for success:
  • Open your dev tool.
  • On the network tab, your payload should contain the following
On successful GA connection
Note: The Event action (ea) and Event label (el) depend on the actionTemplate and labelTemplate

What Is Next

With the above instructions, you should have Google Analytics ready to capture user interactions with your channel.
Last modified 3mo ago