User Identification
User identification is required for ad personalization and proper targeting.
JavaScript Library Installation
Add the library to all pages of your store:
<script src="https://static.mageads.com/ccxid.js"></script>
This automatically creates a ccxuuid cookie with unique user ID.
Retrieving User ID
JavaScript
var userId = window._CcxID.getID();
PHP
function get_user_id() {
if (isset($_COOKIE['ccxuuid'])) {
return $_COOKIE['ccxuuid'];
}
return 'guest';
}
$user_id = get_user_id();
Important
User ID must be base64 url safe encoded when sending in API requests.