Google Analytics

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

To use the Google Analytics plugin, you must import the following library into your code.
import { NinetailedGoogleAnalyticsPlugin } from ‘@ninetailed/experience.js-plugin-google-analytics
// ...
new NinetailedGoogleAnalyticsPlugin({
actionTemplate: 'User has seen personalized component:{{}}',
labelTemplate:'{{ baselineOrVariant }}: {{ component.__typename }} - {{ }}',
//... Your Application Components
To get your Google Analytics trackingId, you can refer to this page

Google Analytics Parameter

To get started with our Analytics plugin, the following parameters are needed. You'll then be able to send events to the preferred Analytic solution for analysis
This is a unique field required by the Analytics tool, to collect data inserted on your platform.
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.