Disabling tracking per user request

Many countries have laws that require you to get a user's consent before you enable tracking.

You may also want to provide some dialog on the first run that asks users whether they want to provide anonymous feedback to help you improve the service. If the user rejects this feedback option, you should probably disable Nucleus integration at the application level.

The Nucleus library provides specific APIs that allow developers to switch tracking features off and on. If the user explicitly states (via the user interface) that anonymous feedback should be disabled, use the following code:

Nucleus.disableTracking()

You can save the user's decision somewhere in the configuration file as a flag and run the code on each application startup.

Depending on the scenario, on each application upgrade, you may also want to ask users whether they wish to enable tracking or keep it disabled. If the user decides to enable automatic feedback, you can use the following function to enable Nucleus integration once more:

Nucleus.enableTracking()

Alternatively, you can set the disableTracking flag when creating a new instance of the Nucleus object at application startup:

const Nucleus = require("electron-nucleus")("<App Id>", {
disableTracking: false
});

We still have our Electron application running in the background. Let's see what happens to the analytics data when we shut the application down.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.82.23