9/12/2014 - 8:41 AM

Read ADF cookie names though the Tridion CD API.

Read ADF cookie names though the Tridion CD API.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="6.1"
    <!-- Cookies settings (optional) -->
        <CookieClaim DefaultValue="true" Name="CookieClaim"/>
        <Cookie Type="Tracking" Name="myTrackingCookie" Path="/"/>
        <Cookie Type="Session" Name="mySessionCookie" Path="/"/>
<!-- Jan Horsman September 2014
This example shows how to read the ADF cookie names through the Tridion Content Delivery API.

The names of the ADF cookies can be configured in the cd_ambient_conf.xml and have default values
in case no cookie name is configured.

The com.tridion.ambientdata.AmbientDataConfig is internal API since it is not documented in the
Tridion CD API docs.

Works with SDL Tridion 2013 SP1 and likely with some earlier Tridion versions as well.
<%@ page import="com.tridion.ambientdata.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

    AmbientDataConfig conf = new AmbientDataConfig();
    CookieConfig cookieConfig;

    cookieConfig = conf.getCookieConfiguration(CookieConfig.CookieType.SESSION);
    String TAFSessionIdCookieName = cookieConfig.getCookieName();
    String TAFSessionIdCookiePath = cookieConfig.getPath();
<strong>ADF session id cookie</strong>
    <li>cookie name: <%=TAFSessionIdCookieName%></li>
    <li>cookie path: <%=TAFSessionIdCookiePath%></li>

    cookieConfig = conf.getCookieConfiguration(CookieConfig.CookieType.TRACKING);
    String TAFTrackingIdCookieName = cookieConfig.getCookieName();
    String TAFTrackingIdCookiePath = cookieConfig.getPath();

<strong>ADF tracking id cookie</strong>
    <li>cookie name: <%=TAFTrackingIdCookieName%></li>
    <li>cookie path: <%=TAFTrackingIdCookiePath%></li>