#Configuration

While the default configuration works for most use cases, you might want to configure some of Engage.js behaviors.
ℹ️ Your Dashboard configuration will override these configuration values unless they have been set with a read-only mode.

#Usage

.config(optionName: String, optionValue: Any, readOnly?: Boolean): Engage

.config(options: Object, readOnly?: Boolean): Engage

index.js
const engage = Engage.init('<your app id>');
// Simplest example
engage.config({ debug: true });
// The 3rd parameter stands for "read-only" (optional).
// If a config value is set as read-only, it is not overridable
// by dashboard configuration.
//
// true -> read-only
// false -> overridable
engage.config('debug', true, true);
// You can pass a single config value by using
engage.config('debug', true);
// And if you want pass multiple config you can do it by passing an object
engage.config({
debug: true,
});
// You can use the `overridable` parameter even when using an object,
// it will apply `overridable` parameter, to every config passed in the object.
engage.config({
debug: true,
}, true);

#Options

#debug

  • Type: Boolean
  • Default: false
When debug mode is enabled, Engage.js will log everything it does in the browser console.
Example
engage.config('debug', true);

#autoPageViews

  • Type: Boolean
  • Default: true
When autoPageViews is enabled, Engage.js will automatically increment the page views counter on every page load (front-end applications using virtual routing should commit pageviews using .commitPageView()).
Example
engage.config('autoPageViews', true);

#stripePublicKey

  • Type: String
  • Default: null
Used to enable Stripe credit card form fields inside elements.
Example
engage.config('stripePublicKey', 'pk_live_12345');

#locale

  • Type: String
  • Default: 'en'
The locale used by default texts inside elements.
Example
engage.config('locale', 'fr');

#pianoAutoTrackingEnabled

  • Type: Boolean
  • Default: false
Enable/disable automatic Piano tracking for particular events.
⚠️ Piano SDK integration required, i.e using pa() tracking method.
Example
engage.config('pianoAutoTrackingEnabled', true);

#gtagAutoTrackingEnabled

  • Type: Boolean
  • Default: false
Enable/disable automatic Google Analytics 4 tracking (Google Analytics 4 tag required) for particular events.
⚠️ Google Analytics 4 integration required, i.e using gtag() tracking method.
Example
engage.config('gtagAutoTrackingEnabled', true);