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.
- JavaScript (Client)
- Node
- Python
import * as EppoSdk from "@eppo/js-client-sdk";
const subjectAttributes = { device: "iOS" };
const variation = EppoSdk.getInstance().getStringAssignment(
"<FLAG-KEY>",
"<SUBJECT-KEY>",
subjectAttributes,
"<DEFAULT-VALUE>"
);
import * as EppoSdk from "@eppo/node-server-sdk";
const subjectAttributes = { device: "iOS" };
const variation = EppoSdk.getInstance().getStringAssignment(
"<FLAG-KEY>",
"<SUBJECT-KEY>",
subjectAttributes,
"<DEFAULT-VALUE>",
);
import eppo_client
client = eppo_client.get_instance()
variation = client.get_string_assignment(
"<FLAG-KEY>",
"<SUBJECT-KEY>",
{ "device": "iOS" },
"<DEFAULT-VALUE>",
)