Skip to main content

Segment Analytics

info

This page is under construction

What is Segment?

Segment is a third-party analytics solution allowing integration with other third-party analytics tracking services under a single, unified API. Analytics data, tracked as events in the Native Apps are sent to Segment for aggregation, which then transforms and forwards them to other analytics service destinations where they can be analysed.

Why do we use Segment?

The Segment Analytics for React Native 2.0 library allows us to control and use several other third-party analytics tracking libraries and SDKs using just the one Segment API.

Instead of having to use the Firebase and Amplitude API to track an analytics event, capturing different data through each for the same event, we can call Segment's API to track the event through both. This makes tracking analytics more streamlined in our code, when dealing with multiple analytics services that we use.

If our business needs change and we consolidate to using fewer or one analytics tracking service in our applications, we may move away from using Segment. If more third-party analytics services are brought on board, Segment provides for the ability to manage them all.

How do we use Segment Analytics?

Setting up the Segment Analytics for React Native library

Note that Segment is already fully integrated and set up in the Native Apps project.

For maintenance purposes, the documentation for the library can be found at the segmentio/analytics-react-native Github project page.

Implementing Segment into the Native Apps project

We abstracts the Segment Analytics for React Native's implementation into a dedicated SegmentAnalytics Module, where we declare and configure the Segment analytics client, which we export as a singleton instance to the rest of the app.

The functionality of the module and its logic are thoroughly documented within the code itself, linked above. Should you change any of the logic within this module, please be sure to update the documenting comments within.

How do we track analytics event with Segment Analytics?

Tracking events using the TagManager module

To track customer analytics events through Segment in the Native Apps project, you will need to use the TagManager module.

The TagManager module is a Vue Plugin, used with the frontend package and is still required in order to access certain computed data about our users, from the legacy Vuex data store, before sending that data as an event property payload via Segment (or previously, Firebase). For an explanation of the legacy Vuex code see this page in our documentation.

To read about how the TagManager Plugin works, see the TagManager page on the main Entain Developers Documentation website.

Event Names and Payloads definitions

To see how the analytics event data we sent through Segment Analytics are structured, have a look at the Analytics Events page on the main Entain Developers Documentation website.

Events Dictionary

The MarTech team maintains a unified Events Dictionary that lists all the events we track (including the event name, and all the properties we need to send along with them). It can be found in Sharepoint here. Note: You may need to reach out to someone in MarTech to get access to the document.

Adding new event definition to track via Segment

Please refer to this the Analytics Guides page on the main Entain Developers Documentation website.

Frequently Asked Question

Please refer to the Analytics FAQ page, which has a comprehensive list of questions and answers for the tracking of new and maintaining existing analytics events using Segment.