For sure it’s interesting to look at global metrics like the total number of users and impressions, but it’s even more valuable to analyse these metrics for certain segments of your audience. Segmented metrics give you insights about who uses your service where and how.

In this article you’ll get an overview of how you can segment your audience using the [Bitmovin Analytics API](🔗).

## By location

A straightforward segment are users watching your videos in certain countries. Before we start, make sure you’ve set up the Bitmovin JavaScript client according to the [Getting started](🔗) guide.

If everything works, let’s count the impressions from Portugal: You can pass any [2-letter country](🔗) code to the country filter.

If you’re interested in more specific results, we can also pass a [region code](🔗):

This will count all the impressions from California. Note that region codes only make sense in the scope of a country, as the same code could be defined for a region of another country as well. Therefore you should always combine the region with a `COUNTRY` filter.

It’s even possible to query for single cities:

Although not mandatory, it’s a good idea to query for the country as well. Otherwise your result will include impressions from the around 30 other cities named Paris around the world. Please only pass the english version of a city’s name and always convert it to lowercase.

## By URL

If your video platform runs on several domains, you can also segment your users by the domain they visited:

This query is particularly useful when you test your service locally or on a separate staging domain, as you can filter out these impressions easily for your production metrics:

If your video platform is organised hierarchically and this hierarchy is reflected in your URLs, you can utilise it for your queries as well:

This query counts all video impression of videos accessed through a path containing `/sports/` – including the slashes. So impressions of videos at `` would be counted, but no impressions of videos at ``

You can use the same technique to exclude certain paths, for example your admin area:

## By device

Bitmovin Analytics tracks several attributes which give you important cues about the devices your audience uses to watch videos on.

Screen width and screen height are important indicators for the kind of device. For example, devices with less than 500 pixels width and less than 900 pixels height are most likely smartphones. Therefore we can count the number of impressions from smartphones like this:

To narrow down the query to only Android phones, let’s filter for the operating system as well:

A full list of platforms supported and how your traffic is distributed:

Identifying your iPhone users is even easier:

You can also use the `DEVICE_TYPE` with Android to query for specific devices:

For a full list of devices your audience uses to watch videos, group the impressions by device type:

## By browser

Another way to segment your users is by browser. You can query for video impressions in Chrome like this:

Why did we use `CONTAINS` instead of `EQ`? Depending on the device, browsers may have different names. Chrome is called “Chrome”, “Chrome Mobile iOS” or “Chrome Mobile”, Firefox is called “Firefox” or “Firefox Mobile”, Safari is called “Safari”, “Mobile Safari” or “Mobile Safari UI/WKWebView”, and so on. Unless you’re interested in these details, you should use a `CONTAINS` query with the general browser name.

It’s even possible to query for a specific browser version:

To find out all browsers people use to watch videos on your platform, group by the browser in your query:

## By player size

When you offer your users to watch videos in full screen, do they really do it? All it takes to find out is a single query:

To count only windowed impressions, use

If you add both total numbers, most likely the sum will be higher than the total number of impressions. That’s because usually users can toggle between windowed and full screen mode. If they toggle while watching a video, the impression will be counted as both windowed and full screen.

To be more specific, you can also query for the video window dimensions directly:

## By many other attributes

There is a plethora of other possibilities to segment your audience. For example, you could get only impressions from videos sent to Chromecast with `.filter('IS_CASTING', 'EQ', 1)` or impressions of live streams with `.filter('IS_LIVE', 'EQ', 1)`.

For an extensive list of filter options, please consult the [Bitmovin Analytics API](🔗) docs.