Back to Publisher API Reference
pbjs.enableAnalytics(config)
Enables sending event data to the analytics provider of your choice. For a list of analytics adapters, see Analytics for Prebid.
Example
pbjs.enableAnalytics([{
provider: "analyticsA",
options: {
sampling: 0.25 // only call the analytics adapter this percent of the time
providerSpecificParams: ...
},
excludeEvents: ['auctionDebug'],
}]);
Parameters
Param | Scope | Type | Description |
---|---|---|---|
provider |
Required | String | Analytics adapter code |
options |
Required | Object | Adapter specific options |
includeEvents |
Optional | Array of strings | Event whitelist; if provided, only these events will be forwarded to the adapter |
excludeEvents |
Optional | Array of strings | Event blacklist; if provided, these events will not be forwarded to the adapter |
Note each analytics adapter has its own invocation parameters. Analytics adapters that are built in the standard way should
support a option.sampling
parameter. You’ll need to check with your analytics provider to confirm
whether their system recommends the use of this parameter. They may have alternate methods of sampling.