GetConsent

by passbird

HTML

<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="utf-8">

    <!-- 
    Import metakeep sdk.
    You can also import npm package if you are using node for building website
    e.g. 
    npm install metakeep@2.2.2
    require(metakeep)
    -->
    <script src="https://cdn.jsdelivr.net/npm/metakeep@2.2.2/lib/index.js" integrity="sha256-XwEVfJ47JrjxB4a8Hyym7/kwX23rmtA1ZW6hbdCW090=" crossorigin="anonymous"></script>
  </head>

</html>

JavaScript

/* Init SDK */
const sdk = new MetaKeep({
  /* App id to configure UI */
  appId: "9cc98bca-da35-4da8-8f10-655b3e51cb9e",
});

/* Call getConsent. It returns a promise which returns when the operation succeeds.
Otherwise throws an error.
*/
async function getConsent(consentToken) {
  try {
    const consentResponse = await sdk.getConsent(consentToken);
    console.log("getConsent successful");
    console.log(consentResponse);
  } catch (err) {
    console.log("Error when trying to get consent");
    console.log(err);
  }
}


getConsent("1234"); // <<== Change here