Skip to content

Commit

Permalink
PBJS: document new enableAnalytics event filter parameters (prebid#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi authored and ecdrsvc committed Sep 6, 2023
1 parent 01b7841 commit db48039
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
37 changes: 28 additions & 9 deletions dev-docs/publisher-api-reference/enableAnalytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,41 @@ description:
---


Enables sending analytics data to the analytics provider of your choice. For a list of analytics adapters, see [Analytics for Prebid](/overview/analytics.html).
Enables sending event data to the analytics provider of your choice. For a list of analytics adapters, see [Analytics for Prebid](/overview/analytics.html).

Note that each analytics adapter has it's own invocation parameters. Analytics adapters that are built in the standard way should
support a `sampling` option. 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.
### Example

```
pbjs.enableAnalytics([{
provider: "analyticsA",
provider: "analyticsA",
options: {
providerSpecificParams: ...
sampling: 0.25 // only call the analytics adapter this percent of the time
}
providerSpecificParams: ...
},
excludeEvents: ['auctionDebug'],
}]);
```

To learn how to build an analytics adapter, see [How to Add an Analytics Adapter](/dev-docs/integrate-with-the-prebid-analytics-api.html).
### Parameters

{: .table .table-bordered .table-striped }
| 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.


### See also

- [Prebid.js events](/dev-docs/publisher-api-reference/getEvents.html)
- [How to Add an Analytics Adapter](/dev-docs/integrate-with-the-prebid-analytics-api.html).


<hr class="full-rule" />
<hr class="full-rule" />
2 changes: 1 addition & 1 deletion overview/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ gulp bundle --modules=exAnalyticsAdapter,xyzBidAdapter
{% endhighlight %}

- If required, load analytics JavaScript from vendor directly on the page
- Call the `pbjs.enableAnalytics()` function
- Call the [`pbjs.enableAnalytics()` function](/dev-docs/publisher-api-reference/enableAnalytics.html)

e.g.

Expand Down

0 comments on commit db48039

Please sign in to comment.