Client-side template implementation notes and tips
Important implementation notes
- Support for multiple variations:
Only API Custom Code campaigns currently support multiple variations. This means that for API Recommendation campaigns, responsechoice
objects return only 1 variation. - Controlling returned values in API Recommendation campaign responses:
The recProductData feature under theoptions
object in the Choose call request enables you to control the values returned in the response: Either SKUs only, or a list of values in the fieldFilter list. The parameter overrides any definition in the client-side template, so make sure to align how you use this feature with the client-side templates.
Implementation tips
- Use Experience APIs to dynamically manage the personalization scope
By using API custom code you can create a campaign with a list of all your campaigns (without targeting, so the answer is consistent) to manage the list of selectors that go into the client-side flow. Just call this campaign once a minute, and use the returned list to determine which selectors remain static and which are personalized by Dynamic Yield using this framework. - Easier engagement reporting
We recommended that you add the following attributes to any element rendered:- API Custom Code campaigns:
decisionId
andvariationId
are necessary to report impressions and clicks. - API Recommendations campaigns: Use
decisionId
andslotId
to report impressions and slot-clicks.
- API Custom Code campaigns:
- Caching templates
We recommend working with some type of caching mechanism for the template code to improve performance. As template changes seldom correspond to template fetching frequency in runtime, and the fact that with each change a new token is created, there's no need to apply any version control logic on your side. Capping the lifecycle of the template (meaning deleting from the cache) after a day/week/month (depending on the frequency of changes in your section) is sufficient to maintain a minimal cache but remain efficient.
Updated about 2 months ago