Filtering by Demographics

One of the most powerful features of PYLON is the access you're given to demographic details of users. We'll take a look at some of the options you have in this document, specifically working with Facebook topic data. Unlike some sources you may have worked with in the past the Facebook graph contains demographic details for the vast majority of users.

You can use any of the examples below when creating an Interaction Filter in the dashboard or when compiling a filter using the API & client libraries.

Stories versus engagements

You might have already read our introduction to Facebook topic data - which explains the data available to you.

When you work with demographic data the targets you use sit in the* and* namespaces.

  • Stories - have authors who's details can be found in the* targets
  • Engagements - have the details of who engaged in the* targets, but also the details of the original story's author in the* targets

It's worth taking a moment to consider what types of interactions you want to filter to. Here are some example scenarios.

All interactions from a demographic

To filter to both stories and engagements created by a certain demographic use both the* targets. This example will capture stories created by people from 35 to 44 and engagements by the same age group on stories posted by anyone of any age group. == "35-44"

note icon

You may have expected the following CSDL for the example above: == "35-44" OR == "35-44"

However this would be incorrect. As both stories and engagements have the* targets the first condition will capture all stories and engagements from the demographic. The second condition using the target will additionally capture engagements by any user on stories created by 35-44 year olds, so engagements by users outside our target demographic.

Stories only from a demographic

To filter to just stories created by a demographic use targets from* and specify stories only using the fb.type target.

fb.type == "story" AND == "35-44"

Engagements only by a demographic

To filter to just engagements created by a demographic use targets from* and specify the engagement types you require using the fb.type target.

fb.type IN "like,comment,reshare" AND == "35-44"

Engagements on stories created by a demographic

To filter to all engagements on stories created by a demographic just use targets from* as only engagements have these targets. In this example using the parent target restricts the data to engagements only and the target itself specifies the age of the author who created the story being engaged on. == "35-44"

note icon

The following examples assume you're filtering for all interactions, but you can use the templates above to adjust your filters as you see fit.

Filtering by age & gender

Age groups

Let's start by looking at age. Authors are grouped in to age bands, these are detailed on the targets pages and

Note that accounts of users under 18 are not available for recording.

To filter to interactions from one specific age group: == "35-44"

Or, to filter to interactions from multiple age groups: in "18-24, 25-34, 35-44"


Looking at gender, authors can be identified as male, female or unknown (when a user hasn't specified this information). Here you'll be working with the and targets.

To filter to a specific gender: == "male"

To exclude a gender: != "unknown"

You can of course combine multiple conditions, such as to look for males between 35 & 44: == "35-44" AND == "male"

Filtering by location

When working with location there a few targets you can work with:

To filter to a certain country you could write a filter like so: == "United States"

Or you could use country codes instead: == "US"

To filter to a list of countries: in "US,UK"

To filter to regions: in "New York,California"

You could of course combine any of the above conditions with logical operators to create tighter filters.

Equally you can make use of the country_region targets, for example you could filter to England in the UK. (These targets can be useful when there are regions with the same name in different countries you are trying to distinguish between.) in "United Kingdom|England"

Filtering by author type

Authors on Facebook are either users or pages. You can distinguish between the two using the and targets.

To filter to just users: == "user"

To exclude a type: != "page"