Modify the e-Marketing Spot JSP file to support the Cookie Contents target
To use the Cookie Contents target in Web activities, add some code to the JSP file for the e-Marketing Spot in which you plan to display the targeted marketing content. This additional code retrieves the specified cookie name and value for each customer who views the page and passes these parameters to the marketing services. The marketing services will display the targeted marketing content to the customer if the cookie name and value matches the criteria set for the target in the Web activity.
Before starting
We need the following information:
- The name of the cookie used in the target.
- The name and location of the JSP file for the e-Marketing Spot used in the Web activity.
Procedure
- In an editor, open the JSP file for the e-Marketing Spot in which you plan to display the targeted marketing content.
- Locate the </wcf:getData> or </wcf:rest> tag.
- Within the tag, add a line of code to the e-Marketing Spot JSP file to pass the cookie name and value to the marketing services.
For example, if the name of the cookie is ZIPCODE, then the line of code looks like this:
<wcf:param name="ZIPCODE" value="${cookie.ZIPCODE.value}" />
Alternatively, we can add lines of code to the JSP file to pass all cookie names and values to the marketing services; however, this is not the preferred method because a large amount of unnecessary data is passed. For this method, the lines of code to add to the e-Marketing Spot JSP file look like this:
<c:forEach var="cookieEntry" items="${cookie}"> <wcf:param name="${cookieEntry.key}" value="${cookieEntry.value.value}" /> </c:forEach>
- Save and close the JSP file.