What is Role-Based Targeting?
Role-based targeting lets you control which users see ads based on their subscription tier. For example, show ads only to free and basic users.
How to set it up
1. Go to Ad Display in your startup dashboard and set the allowed roles (e.g. free, basic).
2. Ensure you call zc.identify() with the user's role before initializing the SDK.
src/zerocost.ts
// 1. Identify user role BEFORE init
zc.identify("user_123", { role: "free" });
// 2. Client-side mirror config
const zc = new ZerocostSDK({
// ...
ads: {
roleTargeting: {
enabled: true,
allowedRoles: ["free", "basic"]
}
}
});
zc.init();