1st Party Cookie
Click Id information should be read from the adp_cid parameter on the request to the website.
Example affiliate url contains unique Click ID and offerId data:
https://yoursite.com/?adp_cid=7ede74f7-db12-4b99-b1ee-2c68247a5c64&adp_oid=555555Adpartners will automatically populate a new Click ID for each customer click with "adp_cid" parameter on query string.
Related offer id will be send at "adp_oid" on query string
The server-side cookie to be produced by the brand should have the following features
• This cookie should be refreshed for every request with Adpartners Click ID.
• Offer Id value should add to cookie value separated with "_" (Underscore) char.
• The cookie domain must be the same as the brand website domain.
• Cookie name must be "_adp".
• The secure attribute of the cookie must be set.
• The cookie period is 13 months. This time is compatible with other storage methods of this solution.
• If your tracking needs require cross-site accessing of the cookie, the SameSite attribute should be set to None.
• The httpOnly attribute should not be set. This ensures that the cookie can be read by JavaScript.
Use the following scripts to set apt cookie
$adp_cid = $_GET['adp_cid'] ?? null;
$adp_oid = $_GET['adp_oid'] ?? null;
if ($adp_cid) {
$adp_cookie_value = $adp_cid . "_" . $adp_oid;
$cookie_options = [
'expires' => time() + (13 * 30 * 24 * 60 * 60),
'path' => '/',
'domain' => '.yoursite.com', // change with brand top level domain
'secure' => false,
'httponly' => false
];
setcookie('_adp', $adp_cookie_value, $cookie_options);
}if (request.getParameter("adp_cid") != null) {
String adp_cookie_value = request.getParameter("adp_cid") + "_" + request.getParameter("adp_oid");
Cookie adpCookie = new Cookie("_adp", adp_cookie_value);
adpCookie.setSecure(false);
adpCookie.setHttpOnly(false);
adpCookie.setPath("/");
// adpCookie.setDomain(".yoursite.com"); // This is optional line if you choose this line beside setPath please change with brand top level domain
adpCookie.setMaxAge(13 * 30 * 24 * 60 * 60); // 13 months in seconds
response.addCookie(adpCookie);
}
If Request.QueryString("adp_cid").Count > 0 Then
Dim adp_cookie_value
adp_cookie_value = Request.QueryString("adp_cid")(0) & "_" & Request.QueryString("adp_oid")(0)
Response.Cookies("_adp") = adp_cookie_value
Response.Cookies("_adp").Domain = ".yoursite.com" ' change with brand top level domain
Response.Cookies("_adp").Expires = DateAdd("m", 13, Now)
Response.Cookies("_adp").HttpOnly = False
Response.Cookies("_adp").Secure = False
End If
if (isset($_GET['adp_cid']) && !empty($_GET['adp_cid'])) {
$adp_cookie_value = $_GET['adp_cid'][0] . "_" . $_GET['adp_oid'][0];
setcookie("_adp", $adp_cookie_value, time() + (13 * 30 * 24 * 60 * 60), '/', '.yoursite.com', false, false);
}<script>
// ALL Pages altında çalışacak kod bloğu
function createAdpCookie() {
var adpCid = getQueryParam("adp_cid");
if (adpCid !== null) {
var adpOid = getQueryParam("adp_oid");
var cookieValue = adpCid + "_" + adpOid;
var expires = new Date();
expires.setMonth(expires.getMonth() + 13);
var domain = window.location.hostname;
domain = domain.startsWith("www.") ? domain.substring(4) : domain;
domain = "." + domain;
document.cookie = "_adp=" + cookieValue + "; expires=" + expires.toUTCString() + "; domain=" + domain + "; secure; SameSite=None";
console.log("Adpartners Cookie oluşturuldu: " + cookieValue);
}
}
function getQueryParam(name) {
var urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
createAdpCookie();
</script>Descriptions:
getQueryParam(name): This is a JavaScript function that retrieves a querystring parameter. Here are the explanations for this function:getQueryParam(name): This function takes a specific parameter name (e.g., "adp_cid" or "adp_oid") and examines the page's querystring to find this parameter.var urlParams = new URLSearchParams(window.location.search);: This line creates a URLSearchParams object to work with the querystring of the current page.return urlParams.get(name);: This line retrieves and returns the value of the specified parameter using the parameter name. If the parameter is not found, it returnsnull.
createAdpCookie(): This JavaScript function is used to create an adpartners cookie. Here are the explanations for this function:var adpCid = getQueryParam("adp_cid");: In this line, the parameter "adp_cid" is retrieved from the querystring and stored in theadpCidvariable.if (adpCid !== null) { ... }: Thisifcondition checks whetheradpCidis null. IfadpCidis not null, the cookie creation process is executed.var adpOid = getQueryParam("adp_oid");: If the "adpCid" value is not null, this line retrieves the "adp_oid" parameter from the querystring and stores it in theadpOidvariable.var cookieValue = adpCid + "_" + adpOid;: The values of "adpCid" and "adpOid" are concatenated with an underscore character to form the value of the cookie.var expires = new Date(); expires.setMonth(expires.getMonth() + 13);: These lines set the cookie's duration to 13 months.var domain = window.location.hostname; ...: The domain for the cookie is extracted from the page's hostname and formatted accordingly.document.cookie = "_adp=" + cookieValue + "; expires=" + expires.toUTCString() + "; domain=" + domain + "; secure; SameSite=None";: In this line, a cookie named "_adp" is created with the specified properties (duration, domain, security, etc.).console.log("Adpartners Cookie created: " + cookieValue);: Finally, the value of the created cookie is logged to the console, providing information to the user.
Last updated