The CAID cookie: your VIP pass for a top level tracking visitors on your website!
🌐 Powered by Commanders Act, the CAID cookie, is your go-to for identifying and tracing a visitor's journey across different browsing sessions.
Its construction is essential, especially in the context of restrictions imposed by privacy and security policies such as ITP (Intelligent Tracking Prevention).
The CAID is automatically created/managed by Commanders Act servers if you choose the proxy method (WAF or on-premise proxy)
You must create it yourself, on your own server, only in the case of "First Party" tracking via CNAME or A-Record, but it is not necessary if you use the proxy method (CloudFlare, etc.). In this documentation, you'll find all the information you need to build it.
Ready to elevate your tracking game and conquer the challenges?
Dive in, and let's make your On-Premise CAID cookie the superhero of your website! 🚀\
How to setup your cookie CAID?
When creating your CAID's cookie, apply the following requirements:
Cookie name
"CAID" (in uppercase)
Cookie structure recommendation
✔️ Contains 20 random characters
✔️ Preceded by the year the cookie was created
🎉 Available on the entire domain and its sub-domains.\
Lifetime
✔️Cookie's expiry date: 12 months after creation date.
Creation and Deposit
✔️Created by the company server (On-Premise).
✔️Deposited on the main domain and all associated sub-domains. (.mydomain.com)
Code snippets
Here are some examples of snippet code to create your On-Premise CAID cookie
<?php$cookie_name ="CAID";$year =date("Y");$random_numbers =substr(str_shuffle(str_repeat('0123456789',20)),0,20);$cookie_value = $year . $random_numbers;$expiration =time()+ (12*30*24*60*60); // 12 months$path ="/"; // Available throughout the domainsetcookie($cookie_name, $cookie_value, ['expires'=> $expiration,'path'=> $path,'httponly'=> true // Enhanced security]);?>
// Node.js with package "express"constexpress=require('express');constapp=express();functiongenerateRandomNumbers() {returnArray.from({ length:20 }, () =>Math.floor(Math.random() *10)).join('');}app.get('/', (req, res) => {constyear=newDate().getFullYear();constrandomNumbers=generateRandomNumbers();res.cookie('CAID', year + randomNumbers, { maxAge:12*30*24*60*60*1000,// 12 months in milliseconds path:'/', httpOnly:true// Enhanced security });res.send('Cookie set');});app.listen(3000, () => {console.log('Server is running on port 3000');});