Intégration du sdk

Pour qu'Axeptio apparaisse sur votre site, il faut charger notre script. Rassurez-vous il ne collecte pas de données personnelles.

Intégration du SDK Axeptio

Pour intégrer Axeptio sur votre site, il faut ajouter ces quelques lignes de codes au pied de chacune de vos pages. Cela va permettre de charger le script Axeptio qui va ensuite s'occuper de piloter l'injection des widgets, l'apparaitrion des cookies, etc.

Le SDK peut être chargé dans la balise <head> ou ajouté avant la fermeture de la balise <body>. Pour de meilleures performances, nous vous conseillons d'opter pour la deuxième méthode, qui permet au script de démarrer le parsing des éléments de la page au plus tôt.

Vous pouvez retrouver ce bout de code et le copier / coller ici :

Mes Projets > Nom du Projet > Intégration technique

Pensez a remplacer la variable VOTRE_PROJET_ID

<script>
window.axeptioSettings = {
  clientId: "{{VOTRE_PROJET_ID}}",
};
 
(function(d, s) {
  var t = d.getElementsByTagName(s)[0], e = d.createElement(s);
  e.async = truee.src = "//static.axept.io/sdk.js";
  t.parentNode.insertBefore(e, t);
})(document, "script");
</script>

Le cas React

Si votre site est en React, vous devrez changer un peu ce code, pour charger une version différente du sdk. Changez cette ligne :

e.async = truee.src = "//static.axept.io/sdk.js";

En ceci :

e.async = truee.src = "//static.axept.io/sdk-slim.js";

Options et mode avancé : Déclarer un objet axeptioSettings dans votre page

Vous pouvez configurer le comportement du SDK en passant des options préalables au chargement du script.

Lors du chargement du script, notre SDK va venir vérifier si un objet axeptioSettings a été préalablement déclaré. Si tel est le cas, il ira piocher dedans ses paramètres :

window.axeptioSettings = {
    userCookiesDuration: 6*30
}

La liste des différentes propriétés de cet objet sont les suivantes :

  /** @type {string} clientId ObjectID corresponding to the project object */
  clientId;

  /** @type {Token} user token set by the website (if the user is logged in)*/
  tokenInstance;

  /**
   * String identifier of the version of Cookie configuration
   * that should be loaded. If this parameter is omitted, then it's the "pages"
   * property in the configuration that gets parsed in case of
   * multiple cookies configurations.
   * @type {string}
   */
  cookiesVersion;

  /**
   * Flag to tell whether GTM Events should be written in the dataLayer variable or not
   * @type {boolean}
   */
  triggerGTMEvents = true;

  /**
   * Name of the cookies containing the JSON value of user choices
   * @type {string}
   */
  jsonCookieName = 'axeptio_cookies';

  /**
   * Name of the cookies that stores authorized vendors (comma-separated string)
   * @type {string}
   */
  authorizedVendorsCookieName = 'axeptio_authorized_vendors';

  /**
   * Name of the cookies that stores authorized vendors (comma-separated string)
   * @type {string}
   */
  allVendorsCookieName = 'axeptio_all_vendors';

  /**
   * Number of days used the cookie holding user's choices should be active
   * @type {number|"page"|"session"}
   */
  userCookiesDuration = 365;

  /**
   * If specified, domain name on which the cookie containing user choices
   * will be available. This allows to request one consent for various subdomains
   * @type {string}
   */
  userCookiesDomain;

  /**
   * If specified, define the SameSite value of the cookie. Usually Lax, Strict or None.
   * @type {string}
   */
  userCookiesSameSite;

  /**
   * Whether or not the cookie holding choices is HTTPS only
   * @type {boolean}
   */
  userCookiesSecure = true;

  /**
   * If set to true, Axeptio will open the cookie widget if the vendors described
   * in the current cookie config do not match the vendors saved in the visitors
   * cookies.
   * @type {boolean}
   */
  openCookiesWidgetIfVendorsMismatch = false;

  /**
   * ClassName of the <div> tag were Axeptio's WebsiteOverlay will be mounted
   * @type {string}
   */
  mountClassName = 'axeptio_mount';

  /**
   * URL on which the widget will send its POST and GET requests
   * for querying and storing consent proofs.
   * @type {string}
   */
  apiUrl = 'https://api.axept.io/v1';
 

Pour les utilisateurs de Gandi ou de Varnish, la mise en cache des contenus interdits l'usage des cookies, à moins que ceux-ci soit préfixés. Cf. la documentation de Gandi à ce sujet. Pour contourner cette limitation, vous pouvez renommer les deux cookies Axeptio en les déclarant dans votre objet axeptioSettings :

window.axeptioSettings = { 
    authorizedVendorsCookieName: "STYXKEY_axeptio_vendors", 
    jsonCookieName: "STYXKEY_axeptio_json" 
}

Dernière mise à jour