SDK Integration
ClientAPI Axeptio is a RESTful JSON / HTTP API that allows you to install and set up Axeptio on your website.
The SDK is a small Javascript file which is loaded by your html page thanks to a tag

Integration

Copy and paste the code snippet below into your source code or in a Tag Management System like Google Tag Manager.
You can find our snippet code in the integration section. Then, you need to copy and paste the script in your source code (all pages).
My projects > Name of the project > Technical integration
1
<script>
2
window.axeptioSettings = {
3
  clientId: "5c11ff5ce95cd64112feab79",
4
};
5
 
6
(function(d, s) {
7
  var t = d.getElementsByTagName(s)[0], e = d.createElement(s);
8
  e.async = true; e.src = "//static.axept.io/sdk.js";
9
  t.parentNode.insertBefore(e, t);
10
})(document, "script");
11
</script>
Copied!

React specificity

If your website is in React, you'll have to modify the code a little, to load a different version of the sdk. Change this line :
1
e.async = true; e.src = "//static.axept.io/sdk.js";
Copied!
Into this :
1
e.async = true; e.src = "//static.axept.io/sdk-slim.js";
Copied!

Detailed Integration

Based on your CMS, we suggest you to click on one of the links below :

Options and advanced mode : Declare an axeptioSettings object in your page

You can configure the SDK behavior by passing options before the script load. For this, there is two options available :
On script load, our SDK will check if an axeptioSettings object was already declared. If it is the case, it will pick in its parameters.
1
window.axeptioSettings = {
2
userCookiesDuration: 6*30
3
}
Copied!

The list of the different properties of this object are the following :

1
/** @type {string} clientId ObjectID corresponding to the project object */
2
clientId;
3
4
/** @type {string} user token set by the website (if the user is logged in)*/
5
token;
6
7
/**
8
* String identifier of the version of Cookie configuration
9
* that should be loaded. If this parameter is omitted, then it's the "pages"
10
* property in the configuration that gets parsed in case of
11
* multiple cookies configurations.
12
* @type {string}
13
*/
14
cookiesVersion;
15
16
/**
17
* Flag to tell whether GTM Events should be written in the dataLayer variable or not
18
* @type {boolean}
19
*/
20
triggerGTMEvents = true;
21
22
/**
23
* Name of the cookies containing the JSON value of user choices
24
* @type {string}
25
*/
26
jsonCookieName = 'axeptio_cookies';
27
28
/**
29
* Name of the cookies that stores authorized vendors (comma-separated string)
30
* @type {string}
31
*/
32
authorizedVendorsCookieName = 'axeptio_authorized_vendors';
33
34
/**
35
* Number of days used the cookie holding user's choices should be active
36
* @type {number}
37
*/
38
userCookiesDuration = 365;
39
40
/**
41
* If specified, domain name on which the cookie containing user choices
42
* will be available. This allows to request one consent for various subdomains
43
* @type {string}
44
*/
45
userCookiesDomain;
46
47
/**
48
* Wether or not the cookie holding choices is HTTPS only
49
* @type {boolean}
50
*/
51
userCookiesSecure = true;
52
53
/**
54
* ClassName of the <div> tag were Axeptio's WebsiteOverlay will be mounted
55
* @type {string}
56
*/
57
mountClassName = 'axeptio_mount';
58
59
/**
60
* URL on which the widget will send its POST and GET requests
61
* for querying and storing consent proofs.
62
* @type {string}
63
*/
64
apiUrl = 'https://api.axept.io/v1';
Copied!
For Gandi or Varnish users, caching contents forbids cookie usage, unless they are prefixed. Cf Gandi documentation on this topic. To dodge this limitation, you can rename the two Axeptio cookies by declaring them in your axeptioSettings object :
1
window.axeptioSettings = {
2
authorizedVendorsCookieName: "STYXKEY_axeptio_vendors",
3
jsonCookieName: "STYXKEY_axeptio_json"
4
}
Copied!
Last modified 8mo ago