Initialize SDK

privo.ageGate.init(config)

interface Configuration {
  serviceIdentifier: string;
  displayMode: AgeGateDisplayMode;
}

type AgeGateDisplayMode = "popup" | "redirect";

The method initiates AgeGate SDK.

Redirect mode implies sending users to a different URL from the one they originally requested. Popup mode implies displaying via a popup browser window that is displayed on top of the existing windows on the screen.

These modes will take place only in case Privo needs to collect some data from the user (for example birth date). Details

Age Gate init entry parameters:

serviceIdentifier - service identifier

displayMode - widget display mode configurations: "popup","redirect"

JS (Typescript) Age Gate SDK location (use it as a script src for SDK uploading):

Development Environment:
https://age-int.privo.com/gate/privo.min.js

Development Environment (Typescript types):
https://age-int.privo.com/gate/privo.d.ts


Production Environment:
https://age.privo.com/gate/privo.min.js

Production Environment (Typescript types):
https://age.privo.com/gate/privo.d.ts

After initialization you can set up onStatusChange callback. See doc

Example:

<!DOCTYPE html>
<html>
<head>
  <title>Age Gate load Demo</title>
  <script src="https://age.privo.com/gate/privo.min.js"></script>
  <script>
    window.onload = async () => {
      privo.ageGate.init({
          serviceIdentifier: "your_identifier",
          displayMode: "redirect"
      });
      const response = await privo.ageGate.getStatus("user-identifier");
      console.log(response)
    }
  </script>
</head>
<body>
</body>
</html>