Initialize LGS SDK

Installation via NPM:

npm install privo-lgs-sdk

Installation via CDN:

Integration Environment:
https://consent-int.privo.com/lgs/privo.min.js

Integration Environment (Typescript types):
https://consent-int.privo.com/lgs/privo.d.ts


Production Environment:
https://consent.privo.com/lgs/privo.min.js

Production Environment (Typescript types):
https://consent.privo.com/lgs/privo.d.ts


Example:
<script src="https://consent.privo.com/lgs/privo.min.js"></script>

Initialization (via NPM):

  import { init } from "privo-lgs-sdk";

  await init(config, env)

Initialization (via CDN):

  privo.lgs.init(config)

  type LGSDisplayMode = "popup" | "redirect" | "iframe";

  interface PartnerConfiguration {
    service_identifier: string;
    display_mode?: LGSDisplayMode;
    is_simple_mode?: boolean;
    container_id?: string;
    styles?: {
        content?: string;
        backdrop?: string;
        frame_width?: number;
        frame_height?: number;
    };
  }

  type EnvType = "int" | "prod";

LGS SDK init entry parameters:

env - type of the PRIVO environment: int - for integration testing, prod - for real users

service_identifier - service identifier provided by Privo.

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

Display mode defines the way of how the widget will be open when the privo.lgs.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.

is_simple_mode - allow to use UI/UX Simple visual mode. In this mode only required elemnts are shown. UI/UX elements like images or explanation sections are hidden

container_id - allow to attach content to specific element id. Work only in combination with display_mode "iframe". If it's empty (undefined) content will be attach to document.body

styles - basic section for integration styling. It allows to style content & wrapper containers. To have more control on theme or text translations inside SDK frame please contact PRIVO support
content - contend styles field inside styles object. Can be used to style privo sdk content frame. Example: "position: fixed; z-index: 9999; top:50%; left:50%; transform: translate(-50%,-50%); border: 1px solid lightgray; border-radius:4px; background: transparent;" Please NOTE - if you are using this field - it will replace ALL default PRIVO content styles. backdrop - backdrop styles field inside styles object. Can be used to style privo sdk backdrop frame. frame_width - width for the sdk frame. If not set, default (recomended) value used. Do not work with display_mode "redirect". frame_height - heigth for the sdk frame. If not set, default (recomended) value used. Do not work with display_mode "redirect".

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>LGS load Demo</title>
  <script src="https://consent-int.privo.com/lgs/privo.min.js"></script>
  <script>
    window.onload = async () => {
      privo.lgs.init({
          serviceIdentifier: "your_identifier",
      });
    }
  </script>
</head>
<body>
</body>
</html>

Example (NPM):

import { init, getInstance } from "privo-lgs-sdk";

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