Skip to main content

Consent Management Platform (CMP)

A CMP makes it easier for you to meet the stricter legal requirements governing data collection in certain parts of the world. It helps you by handling the process of receiving consent to collect user cookies. This also allows you to show ads to users living in those areas.

OW-Electron comes with a built in CMP which your app can utilize out of the box. This allows you to:

  • Check if a user needs to be informed of the CMP.
  • Show the CMP first layer on app launch, rendered by OW-Electron, when the user has not answered it yet.
  • Show the CMP itself (if necessary) and apply any settings needed to the entire OW-Electron package.

Users are then informed about the existence of the CMP, as well as where they can find it in the app.

Surfaceow-electron
Namespaceapp.overwolf
Built-in first layer@overwolf/ow-electron 44.11.3 or later

Overwolf installer CMP mockup​

Below is an interactive mockup of the Overwolf installer with the CMP:

Introducing the CMP to users​

The CMP is broken down into two layers:

  • First layer: the consent screen that summarizes the data processing activities and lets the user accept or manage consent.
  • Second layer: the detailed privacy settings, where the user manages each purpose and vendor.

Who shows the first layer depends on which installer you ship. The second layer is always yours to implement, in the app.

Your installerWho shows the first layerWhat you implement
Overwolf Electron installerThe installer, during installation.The second layer, and the built-in first layer check on every launch, for installs where the installer did not show the first layer.
Your own installerYour app, on launch.The first layer, with the built-in first layer or your own screen, and the second layer.

First layer​

The first layer is the initial consent screen the user sees. Its main purpose is to inform and to offer a quick way to make a decision. The first layer provides:

  • An explanation as to why their data is being collected.
  • Shows that other companies may also process data.
  • Gives clear, balanced buttons like Accept All and Manage Settings.

Overwolf installer​

If your app uses the Overwolf Electron installer, the installer displays the first layer during installation. You still implement the second layer in the app: add a Manage toggle to your privacy settings that opens app.overwolf.openAdPrivacySettingsWindow(). Contact us for more details.

You must also run the built-in first layer check on every launch. It covers every install where the user did not answer the first layer in the installer: an install that came from outside the Overwolf installer, or one where the installer did not show the first layer. When the user answered the first layer in the installer, the check returns false and nothing shows.

Your own installer​

If you ship your own installer, showing the first layer is your responsibility, and it belongs in your app, not in your installer.

important

Do not try to show the CMP first layer from your own installer. The CMP APIs are app-level ow-electron APIs. They exist only inside the installed app at runtime, so your installer process cannot call them. The earliest point you can show the first layer is the first launch of the app.

You have two ways to show it:

OptionWho renders and stores the consentWhen to choose it
Built-in first layer (recommended)ow-electron renders the screen, stores the user's answer, and decides when to show it again.Most apps. You make two API calls.
Your own first layerYour app renders the screen.Your app already has its own first layer, or you need full control over the screen.

Showing the built-in first layer​

ow-electron renders the first layer for you, with the Manage and Accept All Purposes buttons. Call it on every app launch, before your app serves its first ad:

  1. Call app.overwolf.shouldShowCMPFirstLayer().
  2. If it returns true, call app.overwolf.openCMPFirstLayerWindow() with your main window as the parent.
  3. Wrap both calls in try/catch. Both can reject, and your app must still start when they do.
  4. Initialize your ad units only after this resolves: the user finished with the first layer (and with the second layer, if they picked Manage), the check returned false, or a call failed.
important

Initialize your ad units only after the first layer step resolves, in every window that shows ads. An ad unit you initialize earlier requests ads before the user has answered the CMP.

import { app, BrowserWindow } from 'electron';

// Resolves once the first layer is out of the way: answered, not needed,
// or not shown because of an error. Never rejects, so your app always starts.
async function showCMPFirstLayer(mainWindow: BrowserWindow): Promise<void> {
try {
if (await app.overwolf.shouldShowCMPFirstLayer()) {
await app.overwolf.openCMPFirstLayerWindow({ parent: mainWindow });
}
} catch (err) {
// The stored consent could not be read, or the first layer page did not load.
console.error('CMP first layer not shown:', err);
}
}

app.whenReady().then(async () => {
const mainWindow = new BrowserWindow({ width: 1200, height: 800 });
mainWindow.loadFile('index.html');

// The window opens first, then the first layer shows over it.
await showCMPFirstLayer(mainWindow);

// Only now initialize your ad units, in every window that shows ads.
});

When the first layer shows. shouldShowCMPFirstLayer() returns true when the CMP is required for the user (see app.overwolf.isCMPRequired()) and the user has not answered it yet. You do not track this yourself:

CMP required for the userUser answered the CMPshouldShowCMPFirstLayer()
NoNot relevantfalse, on every launch
YesYes, in the installer or in the appfalse, on every launch
YesNotrue, on every launch until the user answers

Any answer counts: the installer's first layer, your app's first layer, or the CMP window. The default consent ow-electron stores on startup does not count as an answer.

important

Do not add your own "already shown" flag around the first layer. A user who has not answered must see it again on the next launch, and your own flag would hide it from exactly that user.

How the first layer behaves.

  • Accept All Purposes stores the consent and closes the first layer.
  • Manage closes the first layer and opens the second layer, modal over the same parent.
  • The first layer has no close button. The user picks Accept All Purposes or Manage.
  • With a parent, it covers the parent's content area with a dimmed backdrop and follows the parent when it moves or resizes. On Windows, dragging the backdrop moves the parent.
  • A parent smaller than the dialog grows to fit it. When the parent can't grow (its maximum size, a small screen, or it is maximized), the first layer opens as a dialog-sized modal window over the parent instead. On macOS the parent stays enabled and the dialog stays above it.
  • On Linux the first layer always opens as a dialog-sized modal window over the parent.
  • The window shows only once the page has rendered its dialog.
  • openCMPFirstLayerWindow() resolves once the user is done: after Accept All Purposes, or after Manage once the second layer closes. It also resolves when the parent closes first.
  • Calling openCMPFirstLayerWindow() again while it is pending focuses the open window and returns the same promise.
  • It rejects when no page loads: a network error, an HTTP error, or no render within 30 seconds.

Building your own first layer​

If you build the first layer yourself, render it in your app on first launch, before your app serves its first ad:

  1. On first launch, call app.overwolf.isCMPRequired().
  2. If it returns true, render your first layer, before the app serves its first ad. Use the example below for the content.
  3. If it returns false, let the user continue without showing the first layer.
  4. Initialize your ad units only after the user answers your first layer, or after isCMPRequired() returns false.
import { app } from 'electron';

// Run this on first launch, before the app serves its first ad.
if (await app.overwolf.isCMPRequired()) {
// Render your first layer here.
// Its Manage button calls app.overwolf.openAdPrivacySettingsWindow()
// to open the second layer.
}

app.overwolf.isCMPRequired() returns true where local law requires consent, typically for users in Europe. For a user outside those regions it returns false, and the app continues without the first layer.

First layer content example. Model your screen's content on this. Link the {ad vendors} text to the vendors tab, and have the Manage button open the second layer.

{App Name} may display in-app ads to help provide you with a free high-quality app.
In order to deliver ads that are relevant for you, {App Name} and trusted {ad vendors}
store and/or access information on your computer, and process personal data such as IP address and cookies.
Click on the “Manage” button to control your consents,
or to object to the processing of your data when done on the basis of legitimate interest.
You can change your preferences at any time via the settings screen.

Purposes we use: Store and/or access information on a device,
personalized ads and content, ad and content measurement,
audience insights and product development.

Second layer​

The second layer opens when the user wants to explore or adjust their settings in more detail. Typically this is done using a Manage Settings or More Options button. This layer gives the user full control and transparency over how their data is handled. The second layer provides:

  • An explanation for the specific purpose of the data use.
  • The option to turn each purpose on or off.
  • Lets users control consent for each vendor individually.
  • Describes special purposes and features.

Every app implements the second layer, whichever installer it ships. Add a Manage toggle to the privacy settings which opens app.overwolf.openAdPrivacySettingsWindow() in your app. Overwolf then handles the changes.

import { app, BrowserWindow } from 'electron';

async function openPrivacySettings(settingsWindow: BrowserWindow): Promise<void> {
await app.overwolf.openAdPrivacySettingsWindow({ parent: settingsWindow, modal: true });
}
note

The CMP and Privacy settings change based on the country the user is in.

To access the second layer:

  1. In the app, the user must be able to access a Manage button in the app's settings.
  2. On the first layer, the user can press Manage, in the app or during installation with the Overwolf installer.

Allowing users to access the CMP​

Once the user has been introduced to the CMP, they must be able to find it if they ever wish to alter its settings.

This is usually achieved by having a clearly visible section in the app's settings, called Privacy, that shows the following when clicked:

Privacy Settings

Pressing Manage then opens the CMP window, in the same way that it was opened at the start.

Styling the CMP windows​

Both CMP windows take the same color and font options, from CMPBaseWindowOptions. Define them once and pass them to both calls, so the first layer and the second layer match your app. Any option you leave out keeps the CMP page's own default.

import { app, BrowserWindow } from 'electron';

const CMP_THEME = {
backgroundColor: '#202020',
textColor: '#EFEFEF',
titleColor: '#EFEFEF',
buttonColor: '#D34037',
buttonHoverColor: '#F05C48',
buttonTextColor: '#FFFFFF',
fontFamily: 'Montserrat, sans-serif',
fontUrl: 'https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap'
};

async function showCMPFirstLayer(mainWindow: BrowserWindow): Promise<void> {
try {
if (await app.overwolf.shouldShowCMPFirstLayer()) {
await app.overwolf.openCMPFirstLayerWindow({ ...CMP_THEME, parent: mainWindow });
}
} catch (err) {
console.error('CMP first layer not shown:', err);
}
}

async function openPrivacySettings(settingsWindow: BrowserWindow): Promise<void> {
await app.overwolf.openAdPrivacySettingsWindow({ ...CMP_THEME, parent: settingsWindow, modal: true });
}

What each option colors:

OptionFirst layerCMP window (second layer)
backgroundColorThe dialog background.The preloader and the page background.
textColorBody text.Body text.
titleColorTitles, links, and the app name.Titles, links, and Reject All Purposes.
buttonColorAccept All Purposes, and the preloader spinner of the second layer that Manage opens (unless preLoaderSpinnerColor is set).Accept All Purposes, the consent switches, the active tab underline, and the preloader spinner (unless preLoaderSpinnerColor is set).
buttonHoverColorAccept All Purposes on hover.Accept All Purposes and the consent switches on hover.
buttonTextColorThe Accept All Purposes label.The Accept All Purposes label.
fontFamily, fontUrlThe page font.The page font.
note

fontUrl must be a Google Fonts CSS URL. URLs on other hosts are ignored. fontFamily accepts letters, digits, spaces, quotes, commas, dots, and dashes only.

Each window also has options of its own. Add them at the call site, not to the shared object: appName, backdrop, and preLoaderSpinnerColor (the spinner of the second layer that Manage opens) for the first layer, tab, width, height, x, y, center, and preLoaderSpinnerColor for the CMP window. For every option and its default, see CMPBaseWindowOptions, CMPFirstLayerWindowOptions, and CMPWindowOptions.

When a user asks to reject consent outside the CMP UI, for example by email, call app.overwolf.rejectAllConsent(). It resolves once the rejected consent is stored, and rejects when the consent page fails to load or does not store it. Calling it again while it is pending returns the same promise. It is safe to call at app startup.

import { app } from 'electron';

try {
await app.overwolf.rejectAllConsent();
} catch (err) {
console.error('Could not reject consent:', err);
}

Testing the CMP locally​

The first layer shows only when the CMP is required for the user and the user has not answered it. On a development machine outside Europe, or one where you already answered once, it never appears. Two steps let you see it:

  1. Force the CMP on. Start your app with the --force-cmp switch. It makes app.overwolf.isCMPRequired() return true in any region.

    npx ow-electron --force-cmp .
  2. Clear the stored answer. With your app closed, open %APPDATA%\ow-electron\<uid>\ow-electron.json and delete its cmp object, then start the app again. ow-electron writes a default consent on startup, which does not count as an answer, so the first layer shows on the next launch.

    To find your app's <uid> folder, look in logs\ow-electron.log inside each folder for the line session start - app '<your-app-name>'. The <uid> changes when your app's main file changes, for example after an ow-electron upgrade, so one machine can have more than one folder for the same app. Clear the cmp object in each of them.

Once you press Accept All Purposes or Manage and save, the CMP is answered again. Clear the stored answer before the next test.

CMP APIs​

The CMP APIs are methods of app.overwolf. Every signature, parameter, default, and option is in the API reference. This section lists what each one is for.

APIWhat it's forReference
app.overwolf.isCMPRequired()Checks whether the user must be informed about the CMP (where local law requires consent).isCMPRequired()
app.overwolf.shouldShowCMPFirstLayer()Checks whether to show the first layer: the CMP is required and the user has not answered it.shouldShowCMPFirstLayer()
app.overwolf.openCMPFirstLayerWindow()Shows the built-in first layer.openCMPFirstLayerWindow(), CMPFirstLayerWindowOptions
app.overwolf.openAdPrivacySettingsWindow()Opens the second layer, the Ad privacy settings window.openAdPrivacySettingsWindow(), CMPWindowOptions
app.overwolf.rejectAllConsent()Rejects all consent when the user asks outside the CMP UI, for example by email.rejectAllConsent()

Both CMP windows share the colors, font, language, and parent options in CMPBaseWindowOptions.

Supported languages​

Use the following table for the language option:

NameKey Code
Englishen
Germande
Portuguesept
Spanishes
Frenchfr
Italianit
Polishpl

app.overwolf.openCMPWindow()​

Deprecated

This API is deprecated. Use app.overwolf.openAdPrivacySettingsWindow() instead.

Using the CMP APIs​

  1. On every launch, call app.overwolf.shouldShowCMPFirstLayer(), and if it returns true, call app.overwolf.openCMPFirstLayerWindow(). If you build your own first layer, call app.overwolf.isCMPRequired() on first launch instead and show your screen when it returns true.
  2. Load ads only after the first layer is out of the way.
  3. Regardless of app.overwolf.isCMPRequired(), implement a Privacy section in your app's settings.
  4. Add a Manage button which calls app.overwolf.openAdPrivacySettingsWindow() to open the second layer of the CMP. Show the button to every user. It does not need to be gated on app.overwolf.isCMPRequired().