# metrics.json

Partially Deprecated

Metrics.json is being phased out. It is only compatible with Legacy Media Groups.

For an XPLib tenant, you must use analytics.json.

All tenant's metrics systems have to be configured in its metrics.json file located in the resources folder of each site code repository.

metrics.json is an opt-in feature and can be activated via a flag in the Tenant's definition.json:







 




{
    "name": "index",
    "title": "Tenant title",
    "uri": "www.example.com",
    "userInterface": {
        "features": {
            "useMetricsJson": true
        }
    }
}

This is an example of the metrics.json of a Tenant with Chartbeat, Comscore and Google Analytics:

{
    "chartbeat": [
        {
            "name": "Chartbeat",
            "uid": "64639",
            "domain": "examplesite.com"
        }
    ],
    "comscore": [
        {
            "name": "comscore",
            "c2Var": "16372580"
        }
    ],
    "googleAnalytics": [
        {
            "name": "google",
            "uaCode": "UA-5645207-1"
        },
        {
            "name": "google-2",
            "uaCode": "UA-5641234-2"
        }
    ]
}

TIP

Note that providers are arrays thus allowing to have multiple instances of the same provider with different configurations. i.e. you can configure multiple googleAnalytics accounts.

# Metrics json schema

Metrics json schema (opens new window) lists all the available providers that are built-in and supported out-of-the-shelve by Marfeel.

The master json schema references sub-schemas for specific providers. i.e adobeNative references its own schema:

"adobeNative": {
    "$ref": "./providers/adobeNative.json"
}

TIP

The schema details of all providers can be found in the metrics catalog documentation.

# Platforms attribute

By default, any metrics system specified in metrics.json will be instantiated in all platforms TOUCH, AMP and CHEROKEE.

In cases where a tracking code needs to be added only in one, or two of those platforms, use the platforms field. It works on all metrics extensions. The metrics extensions catalog details which values are available for which extension.






 






 




{
    "googleAnalytics": [
        {
            "name": "ziaruldeiasia",
            "uaCode": "UA-724574-1",
            "platforms": ["TOUCH"]
        }
    ],
    "facebookMetric": [
        {
            "name": "facebook",
            "id": "1677839712495774",
            "platforms": ["AMP"]
        }
    ]
}

# Inheritance

A Media group can have two tenants that share a common metrics configuration. To avoid code duplication, one of them should extend the other one.

For instance, if wwww.examplesite.com and its subdomain subdomain.examplesite.com use the same codes and are registered in the same repository, this is how the metrics.json of subdomain.examplesite.com should look like:

{
    "extends": "www.examplesite.com/index/resources/metrics.json"
}