# Personalized Offers Object

> **Early Access**
>
> The Personalized Offers feature is in early access. To request access, visit [this page in Chargebee Billing](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/chargebee-growth&ref=feature).

> **Previous Version**
>
> The earlier version of Personalized Offers was delivered via Retention.js, which has since been deprecated. You can still view the [documentation](https://www.chargebee.com/docs/retention/getting-started-guide/chargebee-growth-installation#install-chargebee-retentionjs-deprecated) for reference.

A Personalized Offers instance can be used to dynamically display eligible [offers][personalized-offers-user-docs] to the user.

[Create a `personalizedOffers` object](https://www.chargebee.com/docs/js/cbinstanceobj-api-ref#personalizedoffers) using the `chargebee` object to use the functions listed below.

## Tutorials

For a step-by-step integration, see the [Personalized Offers tutorials](https://www.chargebee.com/tutorials/topics/offers/).

## Initialize personalized offers

### `init()`

Initializes the personalized offers experience and displays eligible offers to the user.

Chargebee detects the pages visited by the user and dynamically displays eligible offers that have been pre-configured in the Retention dashboard.

### Example

```js
personalizedOffers.init({
  account: {
    customerId: "16CRibUdE6pV6HoU"
  },
  externalUserId: "jane_doe",
  roles: ['sales-manager'],
  locale: "fr-FR",
  custom: {
    viewCount: 6
  }
});
```

### Parameters

- `account` (Object, required) Details about the customer.
  - `customerId` (String, required) The unique ID of the customer in Chargebee Billing.
  - `companyName` (String) The name of the customer's company or organization. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
  - `companyDomain` (String) The domain name of the customer's company or organization. For example: `example.com`. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `subscription` (Object, required if multiple brands are configured in the Growth dashboard.) Details about the specific subscription of the customer for which to display the offer.
  - `id` (String, required if multiple brands are configured in the Growth dashboard.) The unique ID of the subscription for which to display the offer. If not provided, Chargebee selects a subscription at random for the customer and displays the offer for that subscription. To ensure the correct offer is shown, provide this parameter if the customer has multiple subscriptions.
  - `plan` (String) The name or category of the subscription plan. For example: `enterprise`, `freemium`. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
  - `planTerm` (String) The billing frequency of the subscription plan. For example: `weekly`, `monthly`, `yearly`. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `firstName` (String) The first name of the logged-in user. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `lastName` (String) The last name of the logged-in user. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `fullName` (String) The full name of the logged-in user. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `email` (String) The email address of the logged-in user or the organization's primary contact. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `externalUserId` (String) The logged-in user's unique ID in your system. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `roles` (Array<String>) A list of roles that the logged-in user has in your application. For example: `['admin']`, `['sales-rep','sales-manager']`. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.
- `locale` (String) The user's locale (for example, `en-US`, `fr-FR`). Chargebee matches this value against the language matching rules configured in the Chargebee Growth dashboard and displays the offer in the matching language. If you omit this parameter, Chargebee matches the browser language instead. If no rule matches, Chargebee displays the offer in your site's primary language, which is English. Requires multi-language support; contact the Chargebee Support to enable it for your site. Until then, Chargebee ignores this parameter. To configure languages, add each language and its matching rules under Settings > Languages in the Chargebee Growth dashboard, then add the translations for each language while setting up offers.
- `custom` (Object) An object containing one or more custom fields defined in the Chargebee Retention dashboard. Ignored if it is not mapped to a field in the Chargebee Retention dashboard.

### Returns

None.

[personalized-offers-user-docs]: https://www.chargebee.com/docs/growth/offers/in-app-offers
