# How to use an Analytics Provider
This article describes the workflows to integrate Analytics providers to a tenant.
Living standard
The workflows described in this article are subject to change as the rollout progresses. Ask BERG if you have any doubt!
# Working with Legacy tenants
Analytics Providers are not compatible with Legacy tenants.
# Working with XPlib tenants
- Install the analytics provider as a package dependency by executing the following command in the Media Group root directory:
npm install @marfeel/analytics-providers-THE_ANALYTICS_PROVIDER_YOU_NEED@latest --save
Create or go to the file
analytics.json
inside the tenant's resources directory.Configure the Analytics Provider inside the
analytics.json
using the properties found in its schema. The object key must be the same as the repository removinganalytics-provider
:
analytics-provider-googleanalytics
becomes googleanalytics
.
{
"googleanalytics": [
{
"vars": {
"account": "XXXXXX"
}
}
]
}
Schema example for Google Analytics (opens new window).
To add custom variables and page metadata to the analytics calls, check the in-depth explanation of how to use middlewares in an anlytics provider.
Test the analytics provider by observing the Network tab of your browser's dev tools: the same requests as on the tenant's original's site must be triggered by the same events.