Initialize Age Estimation SDK

Installation via NPM:

npm install privo-age-estimation-sdk

Installation via CDN:

Integration Environment:
https://age-int.privo.com/estimation/privo.min.js

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


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

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


Example:
<script src="https://age.privo.com/estimation/privo.min.js"></script>

Initialization (via NPM):

  import { init } from "privo-age-estimation-sdk";

  await init(config) 

Initialization (via CDN):

  privo.ageEstimation.init(config)

  interface PartnerConfiguration {
    env: "int" | "prod";
    serviceIdentifier: string;
    displayMode?: "iframe" | "popup" | "redirect";
  }  

Age Estimation init entry parameters:

env - type of the PRIVO environment: int - for integration testing, prod - for real users
serviceIdentifier - service identifier provided by Privo.

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

Display mode defines the way of how the widget will be open when the privo.ageEstimation.run method is called. "redirect" mode sends users to a different URL (PRIVO URL) from the one they originally requested. "popup" mode sends users to a new popup browser window that is displayed on the top of the existing windows on the screen. "iframe" mode opens iframe on the top of the existing page on the screen.

Note: Before real usage please send an email request to devops@privo.com to whitelist your site origin in the PRIVO CORS settings.

After initialization you can set up onStatusChange callback. See doc

Example (CDN):

<!DOCTYPE html>
<html>
<head>
  <title>Age Gate load Demo</title>
  <script src="https://age.privo.com/estimation/privo.min.js"></script>
  <script>
    window.onload = async () => {
      privo.ageEstimation.init({
          env: "prod",
          serviceIdentifier: "your_identifier",
      });
    }
  </script>
</head>
<body>
</body>
</html>

Example (NPM):

import { init } from "privo-age-estimation-sdk";

await init({
  env: "prod",
  serviceIdentifier: "your_identifier",
})