Enable/disable tracking

By default, Panelbear collects pageviews and custom events once the page has loaded. However, some installations might require more control and disable all event tracking temporarily. We offer a configuration option to facilitate these cases.

For example, if your website requires consent before collecting the analytics data, you can use this setting to stop Panelbear from sending the data to our servers, until consent has been given and you re-enable the script.

To disable all event collection, simply set the enabled option to false:

panelbear("config", { enabled: false });

Any attempt to send a pageview or custom event will be blocked while this setting is enabled. To re-enable it, simply set it back to true:

panelbear("config", { enabled: true });