Sample app
Sample app
You can download a sample app to help you get started.
https://github.com/overwolf/ow-electron-packages-sample
This page is only intended to serve as a quick reference to the package.json changes required to use @overwolf/ow-electron. For more information about the the package itself, click here.
Included is a list of important package.json changes that should be included when working with the @overwolf/ow-electron package.
Start and Build
Creating new npm start
and build
commands, for testing and building your app:
{
...
"scripts": {
...
"start:ow-electron": "ow-electron .",
"build:ow-electron": "ow-electron-builder --publish=never"
},
...
}
Anonymous analytics
Anonymous analytics is automatically enabled for any ow-electron app and is used to generate usage reports. Usage reports include data about when the app is launched, and when a the app's window is shown.
App analytics are disabled on a per-session basis. If you wish to completely disable them, you must do so before every app start, when initializing your app.
You can disable these analytics with the following piece of code:
import { app } from 'electron';
app.overwolf.disableAnonymousAnalytics();
...
app.whenReady().then(...)
Unique app ID
Every Overwolf application (ow-electron or Overwolf native), has a unique app id. This unique id is automatically generated, and is based on the app's name, and the app's author's name.
In ow-electron
, these fields correspond to the following fields in the package.json file:
- App name - The
productName
(defaults toname
if missing) properties - App author - The
name
field under theauthor
field.
{
...
"name": "ow-electron-sample-app",
...
"author": {
"name": "Overwolf"
},
"productName": "real-ow-electron-sample-app",
...
"build": {
...
"productName": "unrelated-name-passed-to-builder",
...
},
...
}
Unique app ids are used for ads optimizations, as well as for optional anonymous analytics reports that you may review on our developer's console.
Fetching your app ID
Once your app has loaded, you can fetch the app ID through the API as follows:
import app from 'electron';
...
app.whenReady().then(() => {
const appID = process.env.OVERWOLF_APP_UID;
});
Note that this environment variable will only exist once the app is ready.