Discovering Topics

In this guide we will take a look at discovering topics in Facebook topic data you can access and analyze.

Table of Contents


Topics are most useful for discovering unknown themes and trends in conversations that include specific textual terms of interest.

For example, what else do people mention when they post about cars? DataSift recommend filtering data into your index using keywords and phrases in the text related to the topic, such as car manufacturers and associated categories. For example, when filtering for cars, all interactions matching the "Cars" category and "Jaguar" could be recorded to an index. Analysis of the topics in your dataset may identify interesting trends for more creative insights.

Topic detection is precise rather than broad, for most use cases it is not advisable to use topics as the sole criteria in your interaction filter.

Topic Detection

When a topic is attached to a story for filtering and analysis, that topic is likely to be a strong focus of the story. However, not all mentions of a brand will have the brand's topic attached to them.

Facebook uses natural language processing technology to infer topics, topic detection does not work like a traditional named entity recognition system which attempts to identify all mentions of proper nouns and categorize them. Topic detection is tuned to detect where particular topics are at the heart of the story, rather than delivering high volumes of inference.

Many topics can be attached to a story.

Topic Attributes

Facebook uses the entities of the Social Graph as its topic universe. Interactions are analyzed by Facebook for matches against their social graph of topics. A topic can be a public figure, a place, an event, a movie, or almost anything that you can find in an encyclopedia Examples include entities such as: Toyota, Belgium, Chevrolet Camaro, or Swimming.

Some topics have a page that has been authored and has an owner. An example would be Toyota.

The Facebook Developers site contains a Graph API Explorer tool that displays Social Graph information. Navigate to to use the tool.

Generate an Access Token to enable access to Social Graph information.

  1. Click Get Token button and select "Get Access Token" from the drop down list.

  2. Check user_about_me in the "Select Permissions" pop-up window, and click Get Access Token button.

  3. In the "Log in with Facebook" pop-up window, log in (if you are not already logged into Facebook). Click OK button to generate an Access Token that authorises your Facebook account to access Social Graph data.

  4. Your Access Token is valid for one hour. To display access token information click the Debug button.

  5. Access Token information is displayed in a new browser tab.

Now that you have a valid Access Token, navigate to and display Social Graph information for Toyota:

  1. Copy and paste the Facebook page URL or enter a topic name or ID in the Graph API query field.

  2. Click Submit button.

  3. Topic data is displayed in the right hand pane.

Information about the topic is displayed, which includes the topic ID "197052454200", category "Cars" and name "Toyota USA".

Only the most common topic names are known to PYLON. To guarantee a topic match, use the _fb.topic_ids_ or _fb.parent.topicids target and filter for topics by ID rather than name. This example filters for topic IDs for popular car manufacturers BMW, Ford and Honda.

fb.topic_ids in [22893372268,22166130048,107926874274]or fb.topics_ids in [22893372268,22166130048,107926874274]

Many Topics do not have authored pages, although information about them is still available. The following example shows a page for the Topic "Belgium":

The number in the URL is a Topic ID that can be used to view social graph information about this topic.

Each topic is in a Topic Category. For example, when filtering for different makes of car, all interactions matching the 'Cars' category could be recorded to an index and Query Filters used to identify the car brands (Topics) during analysis. The Topic Category in this example is "Country". Most Topics include information taken from Wikipedia. A list of Facebook topic categories is available here.

Topic Targets

Story topic targets start with fb.topic. Engagement topic targets start with fb.parent.topic. There are currently 12 targets in the fb.topics.* or fb.parent.topics.* namespace that can be used in an Interaction Filter.

See the full list of PYLON targets here.

Topic Filtering Best Practice

Whenever the Facebook topic detector infers a topic, Facebook appends the topic ID to the interaction. These IDs come from a pool of hundreds of millions of pages.

The DataSift platform receives daily updates to a cache of approximately 20 million topic names. When an interaction is received, the platform performs a lookup of any IDs to the available topic names. If the IDs in an interaction are not in the cache, it is still possible to filter and analyze using the ID without the name.

Example Interaction Filter:

fb.topic_ids == "820882001277849"