If desired, Sticky.ID can be integrated using JSON-P. This method involves injecting the Stick.ID URL as a <script>
into the DOM, passing a callback function name in the URL. Our script will call the function specified, passing into it the Sticky.ID payload.
Get user's Sticky.ID with a JSON-P callback
window.callbackFn = function(response) {
var globalUserId = response.id;
var timestamp = response.ts;
var cookieSupport = response.cs;
};
var scr = document.createElement('script');
scr.src = 'https://stickyid-a.akamaihd.net/id?cb=callbackFn';
(document.head||document.body).appendChild(scr);
Example response
The response is similar to what is returned in a normal request. However, because it includes the cb=
parameter, the resulting object will be wrapped in a Javascript function call. An example response when including cb=callbackFn
on the Sticky.ID URL:
callbackFn({"id":"f625e67d9285ac05a110301e4f0a6af7a02ab92f7","ts":1555961788,"cs":1});
Updated about 3 years ago