Newer Version Available
CMS Connector Page Code
If you use CMS Connect to render personalized content in your Experience Builder site,
your setup process requires the following connector JSP page code.
To get your personalized content from Adobe Experience Manager working in your site, create a JSP connector page that contains the following code. You can add to this code as needed. See Personalize Your CMS Content for full instructions on setting up personalization in your site.
The connector JSP page logic includes the following sections:
- Request parameter. The request parameter (payload) contains the data that a site passes to the connector page. It contains componentUrls (an array of component path URLs for which personalization must be run), asset (a JavaScript asset specified in the Asset Path field in the CMS connection that is injected when the JSP page loads), clientContext (IP address, language, country, state, city, latitude, and longitude), requestId (a token that is returned as part of the postMessage to validate the authenticity of the response), and domain (the domain of the site requesting personalized content).
- Personalization JSP logic. We provide you with the basic logic, below. You can add logic as needed.
- JavaScript. In your JSP, include Salesforce-provided JavaScript that sends a postMessage to your site. Construct the script src in this way: <your_site_domain/_sfdc/cms-connect/aem_personalization/salesforceConnector.js>. Any asset specified in the Asset Path field in the CMS connection is included in your JSP.
- Response. The final section constructs the response object and does the postMessage. The JavaScript that you include in the previous section does this.