Release: User Identity resolution, and capturing locale & input field values

Ivar Pruijn

This release makes three additions to the open analytics taxonomy and open model hub:

  • Identity resolution of users across sessions/devices in a new IdentityContext, e.g. using your own internal User IDs, or simply using consent-based cookies;
  • Store the user’s locale/language in a LocaleContext to analyze multilingual applications; and
  • Capture the value of input fields like a search field in an InputValueContext to analyze searches, funnels, etc.
graph LR AbstractContext["AbstractContext<br><span class='properties'>id: string<br />_type: string</span>"] --> AbstractGlobalContext; AbstractGlobalContext --> IdentityContext["IdentityContext<br><span class='properties'>value: string</span>"]; AbstractGlobalContext --> InputValueContext["InputValueContext<br><span class='properties'>value: string</span>"]; AbstractGlobalContext --> LocaleContext; class IdentityContext diagramActive; class InputValueContext diagramActive; class LocaleContext diagramActive; click IdentityContext "https://objectiv.io/docs/taxonomy/reference/global-contexts/IdentityContext" "See details" _self click InputValueContext "https://objectiv.io/docs/taxonomy/reference/global-contexts/InputValueContext" "See details" _self click LocaleContext "https://objectiv.io/docs/taxonomy/reference/global-contexts/LocaleContext" "See details" _self

Global Contexts in the open analytics taxonomy; newly added highlighted

IdentityContext & Identity Resolution

Objectiv now enables you to easily configure a user’s identity during modeling with any identifier (e.g. a unique internal hashed ID, or an email address), and apply that to all users’ behavior retroactively. For instance, throughout a user’s journey, they can first just have a session cookie, and then get an ID on login or signup, which is automatically applied to all events that happened before. This also allows you to track their behavior across sessions, platforms, devices, etc.

To enable this, we added:

  • An IdentityContext to the open analytics taxonomy, which captures the identification method (e.g. a hashed user ID) and the value of the identifier.
  • A plugin for the Tracker SDKs to capture the IdentityContext, e.g. for React.
  • Parameters on creating the Objectiv DataFrame in the open model hub, to specify the right identity resolution and (optionally) how to handle anonymization.

How to use it in the open model hub?

Identity Resolution should be configured on creating the Objectiv DataFrame, e.g.:

get_objectiv_dataframe(identity_resolution=’email’, 
anonymize_unidentified_users=False)

What this example above does is assign the last identity available to all events captured in the session, with any parallel sessions (e.g. same user logged in on multiple devices) remaining intact. As the anonymize_unidentified_users parameter is set to False, sessions for users that do not have a new identity are not fully anonymized, and for instance keep their original cookie ID.

How to use it in the Tracker SDK?

The Tracker should be instructed to track the user identity explicitly in the new IdentityContext.

All that’s required is to track at least 1 event within the session that carries the IdentityContext, e.g. on tracker initialization or login. On all platforms there’s an IdentityContextPlugin to help with this (e.g. for React).

Example on user login:

/**
* In this example we append the identity of the logged in user when triggering
* a success event from a hypothetical Login button.
*/
const trackSuccessEvent = useSuccessEventTracker()

trackSuccessEvent({
message: 'Logged in successfully',
globalContexts: [
new IdentityContextPlugin({
id: 'authentication',
value: response.user_id
})
]
});

LocaleContext

If your application is multilingual, the new LocaleContext can be used to capture the locale used by the user, e.g. in an ISO 639-1 code.

For example, to set the locale from the URL in React, use the following on tracker initialization:

const tracker = new ReactTracker({
applicationId: 'app-id',
endpoint: 'https://collector.app.dev',
plugins: [
new LocaleContextPlugin({
idFactoryFunction: () => location.pathname.split('/')[1] ?? null
})
]
});

This GlobalContext can then be easily used to slice on in modeling (see the open taxonomy example notebook in our documentation).

InputValueContext

The newly added InputValueContext can be used to track a user’s input value. This enables, for instance, to analyze searches performed on your site, navigation via dropdowns, or funnel usage. The tracker SDKs also enable automatically tracking these InputValueContexts.

For example, on input change for input fields on React:

<TrackedInput id={'search'} placeholder={'🔍'} trackValue={true} />

Another example: the value of a switch on React Native.

<TrackedSwitch
id="on-off"
onValueChange={toggleSwitch}
value={isEnabled}
trackValue={true}
/>

This GlobalContext can then be easily used in modeling (see the open taxonomy example notebook in our documentation).

How to get it

To capture the new Contexts, new versions of the tracker are available on NPM. To upgrade or install, follow instructions for your platform.

To use the new Contexts & functions in modeling, update or install your model hub packages.

Install from PyPI:

pip install objectiv-modelhub

To upgrade:

pip install --upgrade objectiv-modelhub

Summarizing

We added three new Contexts and functions to the open analytics taxonomy and open model hub to enable you to easily perform identity resolution of users across sessions/devices, store the user’s locale/language for multilingual applications, and capture the value of input fields like a search field for analysis.

Use/upgrade the Objectiv Trackers to get the latest functionality to easily track the new Contexts, and get the latest modelhub package to use them in your analyses.

info

Office Hours

If you have any questions about this release or anything else, or if you just want to say 'Hi!' to team Objectiv, we have Office Hours every Thursday at 4pm CET, 10am EST that you can freely dial in to. If you're in a timezone that doesn’t fit well, just ping us on Slack and we'll send over an invite for a better moment.

Join the Office Hours

Try Objectiv

Get Objectiv Up - Try Objectiv on your local machine (takes 5 minutes)
Objectiv on GitHub - Check out the project and star us for future reference
Objectiv on Slack - Join the discussion or get help