Skip to content

A/B/x Testing with Unleash Hotjar Integration

ℹ️ Status: 🟢 Production

With the move from Monolith to Statista 4.0, the A/B/x Testing on our pages was only partially moved, important clues for analysis and optimization are missing for the teams to advance our pages and our product.

ℹ️ Info

Ticket: MART-2343

Table of Contents

  1. Scope
  2. Acceptance Criteria

Scope

Acceptance Criteria

What integration solutions are available? In this way, we can keep the implementation effort as low as possible.

  • User must be in multiple experiments at the same time
  • Check if GTM or Unleash and where to get the data
  • Experiments should be treated as dynamic
  • Consistent Naming

User must be in multiple experiments at the same time

This is handled automatically by Unleash. It uses the session-based StatistaTrackingUUID. The assignment to the experiment is done through the StatistaTrackingUUID and the weight is configured through Unleash. Unleash takes care of assigning users to A or B (or X). Users will be assigned to a experiment app-wise (microservice-wise). If User A visits UAO, then they get assigned to their experiments. Afterwards, if the user decides to go to the XMO, then they get assigned to their experiments as well.

Check if GTM or Unleash and where to get the data

As mentioned, Unleash takes care of assigning users to a experiment. GTM then expects the object with featureName, userTestVariant and experimentId to be pushed into the array user_ab_test_variants in the init dataLayer event from GTM. Therefore, the Hotjar agent could retrieve that information as well and send it to Hotjar.

Experiments should be treated as dynamic

For this, there are two solutions available.

1. Poll for "init" dataLayer event pushed by GTM Tracking lib

In the runtime, we can wait for the "init" dataLayer event pushed by GTM and set a variable userABTestVariant with the array from user_ab_test_variants in the "init" dataLayer event pushed by GTM. The Hotjar Agent will listen to changes regarding the runtime variable and sends the information to Hotjar.

2. Expect apps to add the information as a global variable instantly

We would not spend time waiting for "init" and access it directly on app start.

Sending information to Hotjar

This will work by adding the information about the assignment here. Just in a plain way. This means, in the same structure and way that we receive it (featureName, userTestVariant and experimentId added as user traits).

Consistent Naming

Regarding conventions, we could abstract a little and add methods in remix-tools that are inspired by the implementation of the UAO team.

Additionally or alternatively (depends on the level of abstraction that is possible) we would need to implement a process and documentation what information needs to be accessible in the frontend to get picked up by MTAM (e. g. "If you run a A/B/x test on 4.0 pages, then include featureName, userTestVariant and experimentId in then array user_ab_test_variants in the init dataLayer event from GTM. Please stick to the following naming conventions: ...").

Authors: Phil Pieper