Developer Guide: Specifying Topics for Analysis

Many strategies allow you to specify topics for your analysis. In this guide you'll learn how to specify topics through keywords and concepts that appear in content.

How do you define a topic?

Before we look at the parameters you can use to specify a topic, lets first clarify how a topic is defined.

When using the Media Strategies API a topic is defined by a set of keywords and concepts which appear (or do not appear) in content that is being engaged with by an audience. The API allows you to define topics using keywords, concepts, or a combination of the two.

For example the topic of 'Artificial Intelligence' could be defined using the following keywords; ai, artificial intelligence, deep learning, machine learning. If we use this definition the API will analyze the engagement of members who click, view, comment on, or like content containing these keywords.

Specifying topics using keywords

When you define a topic using keywords you are telling the API which keywords must and must not appear in the content that is being engaged with. The API will check the title of summary of content for the keywords you specify, but does not include the body of the content.

The keywords parameter type allows you to specify a topic using sets of keywords. For example, if we wanted to analyze the audience interested in scalability of cloud computing platforms, we could use the following parameters:

{
  "type": "strategy",
  "subscription_id": "cd99abbc812f646c77bfd8ddf767a134f0b91e84",
  "name": "Audience Breakdown for cloud scalability",
  "parameters": {
    "strategy": "audience_breakdown",
    "version": 1,
    "parameters": {
      "keywords": {
        "all": [ "scalability" ],
        "any": [ "azure", "aws", "google cloud", "vmware" ],
        "none": [ "job", "hiring", "career" ]
      },
      "comparison_audience": "global"
    }
  }
}

The parameters use the any, all, and not conditions of the keyword parameter as follows:

  • all - content engaged with must include the keyword 'scalability'.
  • any - content engaged with must include one of the cloud platforms we're interested.
  • none - removes noise, content must not include words relating to jobs.

Specifying topics using concepts

When you define a topic using concepts you are telling the API which concepts must and must not appear in the content that is being engaged with. The API will check the body of the content for the concepts you specify.

The concepts parameter type allows you to specify a topic using sets of concepts. For example, if we wanted to analyze the audience engaging with the concept of "cloud computing", we could use the following parameters:

{
  "type": "strategy",
  "subscription_id": "cd99abbc812f646c77bfd8ddf767a134f0b91e84",
  "name": "Audience Breakdown for cloud computing concept",
  "parameters": {
    "strategy": "audience_breakdown",
    "version": 1,
    "parameters": {
      "concepts": {
        "all": [ "Cloud_computing" ],
        "any": [ ["company", "Microsoft"], ["company", "IBM"], ["company", "Oracle"], ["company", "Google"] ]
      },
      "comparison_audience": "global"
    }
  }
}

The parameters use the any and all conditions of the concepts parameter as follows:

  • all - content must mention the 'Cloud_computing' concept.
  • any - content must include one of the companies listed.

As with the keywords example above we could also use the not condition to filter out noise if necessary.

note icon

Note that the 'Cloud_computing' concept has been used without a type, so this will match any concept with the name 'Cloud_computing', regradless of its type. Whereas the companies have all been included with the type 'company'. This ensures that only concepts of type company are matched.

You can declare concepts with or without types, but we recommend that you use types where possible to ensure accurate analysis.

Using both keywords and concepts

You can also use keywords and concepts parameters together specify a topic. If you specify both parameters content that is analyzed must meet both the keywords and concept conditions you specify.