HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket


This section applies only if you are still using Content Delivery Api v2.x.x. For users using Content Delivery API v3.x.x, see [Breaking change in v3](🔗).

How do you add content personalization to a headless solution where the tracking does not hit a controller in the presentation layer?  You can use a headless approach for content recommendations through the Optimizely Content Delivery API. To do this you need to implement compatible tracking and calls to the recommendation API. See [Tracking](🔗).

In a headless scenario, you can also customize the `DefaultContentModelMapper` and replace it with your own. See [Customizing data returned to clients](🔗) and [Serialization](🔗).

Example: Customizing `DefaultContentModelMapper`

You can manipulate with personalization by customizing the `DefaultContentModelMapper`.

  1. Create a new class where your `CustomContentModelMapper` inherits from `DefaultContentModelMapper`. Register it with `ServiceConfiguration` and in `DependencyResolverInitialization` (this is an example from an Alloy site).

  1. With `CustomContentModelMapper`

In this way, you can take advantage of personalization parameters in your request.


The `DefaultContentModelMapper` is currently marked as internal, so there is a risk of unadvertised breaking changes when customizing this.