Skip to main content

Behavior tracking

Optimize Deprecation

Uniform Optimize has been deprecated and replaced by Context, a more powerful and flexible personalization solution. Optimize is not being discontinued at this time, but it will not receive updates or new features.

We do not recommend starting a new project with Optimize. If you have an existing project that uses Optimize, you can upgrade your project to Context at no cost using our upgrade guide. If you have any issues with this process you can contact our team.

Components and/or pages that have been tagged with behavior tagging that should influence how a visitor is classified need to push these tags into the tracker. To help facilitate this, we have provided a hook called useBehaviorTracking.

Usage for importing this hook and pushing a tag looks like this:

import { useBehaviorTracking } from '@uniformdev/optimize-tracker-react';

const Hero = ({ fields }) => {

return <h1>Which hero is your favorite?</h1>;

Each component that renders can be tagged for behavior needs this hook for behavior tracking to work correctly. During render, all behavior data tracked is combined and weighted into the visitor's intent scores.

For example, a page may have both a Hero tagged with intent1 and a Callout tagged with intent2. The visitor will receive an intent score in both intent1 and intent2 by visiting this page.

It's also possible to push arbitrary behavior into the tracker from components by manually constructing the IntentTags object:

// TypeScript
import { IntentTags, IntentTagStrength } from '@uniformdev/optimize-common';

const Hero = ({ fields }) => {
// this will create an arbitrary intent tag that will track
// behavior related to the `lovesDocumentation` intent.
// The intent must be defined in your intent manifest.
const beh: IntentTags = {
intents: {
lovesDocumentation: { str: IntentTagStrength.Normal },


return <h1>Which hero is your favorite?</h1>;

Behavior push events that are triggered from components that are descendants of a <Personalize /> component will be ignored. The reason being that personalization has already occurred via the <Personalize /> component and therefore pushing additional behavior from descendants would only artificially amplify this behavior. An example of this could be showing a marketing related Hero component to someone who is already classified as marketer.