Skip to main content

Subject attributes

You can pass Eppo subject attributes to take advantage of advanced targeting conditions, like app versions or country checks. See targeting rules for how to configure these in the Eppo application.

Pass subject attributes to the Eppo SDK

The below code examples show how to pass a value for a "device" attribute. The subject attributes are a free-form map, so you may also pass any other attribute names.

import * as EppoSdk from "@eppo/js-client-sdk";

const subjectAttributes = { device: "iOS" };
const variation = EppoSdk.getInstance().getStringAssignment(
"<SUBJECT-KEY>",
"<FLAG-KEY>",
"<DEFAULT-VALUE>",
subjectAttributes
);