NAVNavbar
Logo
cURL php NodeJS Python cSharp

Content Analysis – Rating Distribution API


This endpoint will provide you with rating distribution data for the keyword and other parameters specified in the request.

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-dashboard

<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-dashboard
$client = new RestClient($api_url, null, 'login', 'password');
$post_array = array();
// simple way to set a task
$post_array[] = array(
   "keyword" => "logitech",
   "search_mode" => as_is,
   "internal_list_limit" => 10
);
try {
   // POST /v3/content_analysis/rating_distribution/live
   $result = $client->post('/v3/content_analysis/rating_distribution/live', $post_array);
   print_r($result);
   // do something with post result
} catch (RestClientException $e) {
   echo "n";
   print "HTTP code: {$e->getHttpCode()}n";
   print "Error code: {$e->getCode()}n";
   print "Message: {$e->getMessage()}n";
   print  $e->getTraceAsString();
   echo "n";
}
$client = null;
?>

The above command returns JSON structured like this:

{
  "version": "0.1.20220819",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "16.8783 sec.",
  "cost": 0.0203,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "11041243-1535-0466-0000-3280caf1189e",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "16.8151 sec.",
      "cost": 0.0203,
      "result_count": 10,
      "path": [
        "v3",
        "content_analysis",
        "rating_distribution",
        "live"
      ],
      "data": {
        "api": "content_analysis",
        "function": "rating_distribution",
        "keyword": "logitech",
        "search_mode": "as_is",
        "internal_list_limit": 10
      },
      "result": [
        {
          "type": "content_analysis_rating_distribution",
          "min": 0,
          "max": 0.1,
          "metrics": {
            "type": "content_analysis_summary",
            "total_count": 189,
            "rank": 211,
            "top_domains": [
              {
                "domain": "pcwelt.de",
                "count": 35
              },
              {
                "domain": "macwelt.de",
                "count": 21
              },
              {
                "domain": "macworld.com",
                "count": 3
              },
              {
                "domain": "pcworld.com",
                "count": 1
              },
              {
                "domain": "pocket-lint.com",
                "count": 1
              },
              {
                "domain": "techadvisor.com",
                "count": 1
              }
            ],
            "sentiment_connotations": {
              "anger": 0,
              "happiness": 18,
              "love": 0,
              "sadness": 0,
              "share": 0,
              "fun": 2
            },
            "connotation_types": {
              "positive": 51,
              "negative": 32,
              "neutral": 67
            },
            "text_categories": [
              {
                "category": [
                  10013,
                  10019,
                  10167,
                  10002,
                  10028,
                  10222,
                  13813
                ],
                "count": 13
              },
              {
                "category": [
                  10019,
                  10167,
                  10013,
                  10007,
                  13418
                ],
                "count": 12
              },
              {
                "category": [
                  10019,
                  10167,
                  10013,
                  10002,
                  10028,
                  10222,
                  13813
                ],
                "count": 11
              },
              {
                "category": [
                  10013,
                  10019,
                  10167
                ],
                "count": 9
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054,
                  10168,
                  10883,
                  12187,
                  13068
                ],
                "count": 6
              },
              {
                "category": [
                  10019,
                  10167,
                  10013
                ],
                "count": 6
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054,
                  10013
                ],
                "count": 5
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418,
                  10013
                ],
                "count": 5
              },
              {
                "category": [
                  10013,
                  10019,
                  10167,
                  10007,
                  13418
                ],
                "count": 4
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054,
                  10108
                ],
                "count": 4
              }
            ],
            "page_categories": [
              {
                "category": [
                  10019,
                  10167,
                  10168,
                  10883,
                  12187,
                  13068,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 2
              },
              {
                "category": [
                  10019,
                  10167,
                  10872,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 2
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12216,
                  12222
                ],
                "count": 2
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10001,
                  10026,
                  10209,
                  10019,
                  10167
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10009,
                  10410,
                  10417
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10013,
                  10019,
                  10167
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10019,
                  10167,
                  10168,
                  10886,
                  12216
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10019,
                  10167,
                  10873,
                  12138,
                  10013,
                  10109,
                  10592,
                  13537
                ],
                "count": 1
              },
              {
                "category": [
                  10002,
                  10028,
                  10222,
                  13813,
                  10108,
                  10004,
                  10276,
                  11088,
                  13412
                ],
                "count": 1
              },
              {
                "category": [
                  10004,
                  10307,
                  10002,
                  10028,
                  10222,
                  13813,
                  10013
                ],
                "count": 1
              }
            ],
            "page_types": {
              "blogs": 35,
              "organization": null,
              "news": 1,
              "message-boards": null,
              "ecommerce": 61
            },
            "countries": {
              "DE": 56,
              "US": 5,
              "WW": 1
            },
            "languages": {
              "de": 175,
              "en": 14
            }
          }
        },
        {
          "type": "content_analysis_rating_distribution",
          "min": 0.1,
          "max": 0.2,
          "metrics": {
            "type": "content_analysis_summary",
            "total_count": 1840,
            "rank": 270,
            "top_domains": [
              {
                "domain": "csh.ro",
                "count": 170
              },
              {
                "domain": "plazacompare.com",
                "count": 30
              },
              {
                "domain": "x-kom.pl",
                "count": 30
              },
              {
                "domain": "trending-electronics.com",
                "count": 24
              },
              {
                "domain": "geendank.com",
                "count": 23
              },
              {
                "domain": "mediamarkt.de",
                "count": 23
              },
              {
                "domain": "scoopdeals.com",
                "count": 21
              },
              {
                "domain": "librarii.ro",
                "count": 20
              },
              {
                "domain": "pcoverhauls.com",
                "count": 14
              },
              {
                "domain": "dealwithit.gr",
                "count": 13
              }
            ],
            "sentiment_connotations": {
              "anger": 5,
              "happiness": 75,
              "love": 0,
              "sadness": 5,
              "share": 38,
              "fun": 6
            },
            "connotation_types": {
              "positive": 280,
              "negative": 648,
              "neutral": 905
            },
            "text_categories": [
              {
                "category": null,
                "count": 499
              },
              {
                "category": [
                  10013,
                  10108,
                  13691
                ],
                "count": 103
              },
              {
                "category": [
                  10019,
                  10167
                ],
                "count": 43
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418
                ],
                "count": 34
              },
              {
                "category": [
                  10108,
                  13691,
                  10013,
                  10103,
                  10556
                ],
                "count": 32
              },
              {
                "category": [
                  10019,
                  10167,
                  10013
                ],
                "count": 30
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12222,
                  12216
                ],
                "count": 29
              },
              {
                "category": [
                  10013,
                  10019,
                  10167
                ],
                "count": 25
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 25
              },
              {
                "category": [
                  10108,
                  13691,
                  10013
                ],
                "count": 25
              }
            ],
            "page_categories": [
              {
                "category": null,
                "count": 229
              },
              {
                "category": [
                  10019,
                  10167
                ],
                "count": 15
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 14
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12216,
                  12222
                ],
                "count": 14
              },
              {
                "category": [
                  10019,
                  10168,
                  10883,
                  12187,
                  13069,
                  10886,
                  12216,
                  12188,
                  13073
                ],
                "count": 12
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418
                ],
                "count": 9
              },
              {
                "category": [
                  10019,
                  10168,
                  10883,
                  12187,
                  13069,
                  10886,
                  12216,
                  13068
                ],
                "count": 8
              },
              {
                "category": [
                  10019,
                  10168,
                  10886,
                  12222,
                  12216
                ],
                "count": 8
              },
              {
                "category": [
                  10019,
                  10167,
                  10007,
                  13418,
                  10878,
                  13381,
                  12161,
                  13054
                ],
                "count": 5
              },
              {
                "category": [
                  10019,
                  10167,
                  10013
                ],
                "count": 5
              }
            ],
            "page_types": {
              "blogs": 146,
              "organization": 89,
              "news": 8,
              "message-boards": null,
              "ecommerce": 445
            },
            "countries": {
              "RO": 190,
              "US": 90,
              "PL": 32,
              "WW": 30,
              "DE": 26,
              "FR": 18,
              "UA": 17,
              "GR": 13,
              "GB": 12,
              "AR": 9
            },
            "languages": {
              "en": 1094,
              "pl": 181,
              "de": 141,
              "nl": 68,
              "ro": 65,
              "ru": 59,
              "es": 55,
              "it": 44,
              "fr": 41,
              "vi": 32
            }
          }
        }
      ]
    }
  ]
}

All POST data should be sent in the JSON format (UTF-8 encoding). The task setting is done using the POST method. When setting a task, you should send all task parameters in the task array of the generic POST array. You can send up to 2000 API calls per minute.

Below you will find a detailed description of the fields you can use for setting a task.

Description of the fields for setting a task:

Field name Type Description
keyword string target keyword
required field
UTF-8 encoding
a keyword should be at least 3 characters long;
the keywords will be converted to a lowercase format;
Note: to match an exact phrase instead of a stand-alone keyword, use double quotes and backslashes;
example:
"keyword": "\"tesla palo alto\""
keyword_fields object target keyword fields and target keywords
optional field
use this parameter to filter the dataset by keywords that certain fields should contain;
fields you can specify: title, main_title, previous_title, snippet
you can indicate several fields;
Note: to match an exact phrase instead of a stand-alone keyword, use double quotes and backslashes;
example:
"keyword_fields": {
  "snippet": "\"logitech mouse\"",
  "main_title": "sale"
}
page_type array target page types
optional field
use this parameter to filter the dataset by page types
possible values:
"ecommerce", "news", "blogs", "message-boards", "organization"
internal_list_limit integer maximum number of elements within internal arrays
optional field
you can use this field to limit the number of elements within the following arrays:
top_domains
text_categories
page_categories
countries
languages
default value: 1
maximum value: 20
search_mode string results grouping type
optional field
possible grouping types:
as_is – returns all citations for the target keyword
one_per_domain – returns one citation of the keyword per domain
default value: as_is
positive_connotation_threshold float positive connotation threshold
optional field
specified as the probability index threshold for positive sentiment related to the citation content
if you specify this field, connotation_types object in the response will only contain data on citations with positive sentiment probability more than or equal to the specified value
possible values: from 0 to 1
default value: 0.4
sentiments_connotation_threshold float sentiment connotation threshold
optional field
specified as the probability index threshold for sentiment connotations related to the citation content
if you specify this field, sentiment_connotations object in the response will only contain data on citations where the probability per each sentiment is more than or equal to the specified value
possible values: from 0 to 1
default value: 0.4
initial_dataset_filters array initial dataset filtering parameters
optional field
you can add several filters at once (8 filters maximum)
you should set a logical operator and, or between the conditions
the following operators are supported:
regex, <, <=, >, >=, =, <>, in, not_in, like,not_like, has, has_not
you can use the % operator with like and not_like to match any string of zero or more characters
example:
["domain","<>", "logitech.com"]

[["domain","<>","logitech.com"],"and",["content_info.connotation_types.negative",">",1000]]

[["domain","<>","logitech.com"]],
"and",
[["content_info.connotation_types.negative",">",1000],
"or",
["content_info.text_category","has",10994]]]

for more information about filters, please refer to Content Analysis API – Filters

tag string user-defined task identifier
optional field
the character limit is 255
you can use this parameter to identify the task and match it with the result
you will find the specified tag value in the data object of the response

As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

Description of the fields in the results array:

Field name Type Description
version string the current version of the API
status_code integer general status code
you can find the full list of the response codes here
Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions
status_message string general informational message
you can find the full list of general informational messages here
time string execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasks array
tasks_error integer the number of tasks in the tasks array returned with an error
tasks array array of tasks
        id string task identifier
unique task identifier in our system in the UUID format
        status_code integer status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here
        status_message string informational message of the task
you can find the full list of general informational messages here
        time string execution time, seconds
        cost float cost of the task, USD
        result_count integer number of elements in the result array
        path array URL path
        data object contains the same parameters that you specified in the POST request
        result array array of results
            type string type of element = ‘content_analysis_rating_distribution’
            min float min rating on a distribution scale
            max float max rating on a distribution scale
            metrics object contains rating distribution metrics
                type string type of element = ‘content_analysis_summary’
                total_count integer total amount of results in our database relevant to your request
                rank integer rank of all URLs citing the keyword
normalized sum of ranks of all URLs citing the target keyword
                top_domains array top domains citing the target keyword
contains objects with top domains citing the target keyword and citation count per each domain
                sentiment_connotations object sentiment connotations
contains sentiments (emotional reactions) related to the target keyword citation and the number of citations per each sentiment;
possible connotations: "anger", "happiness", "love", "sadness", "share", "fun"
                connotation_types object connotation types
contains types of sentiments (sentiment polarity) related to the keyword citation and citation count per each sentiment type;
possible connotation types: "positive", "negative", "neutral"
                text_categories array text categories
contains objects with text categories and citation count in each text category
to obtain a full list of available categories, refer to the Categories endpoint
                page_categories array page categories
contains objects with page categories and citation count in each page category
to obtain a full list of available categories, refer to the Categories endpoint
                page_types object page types
contains page types and citation count per each page type
                countries object countries
contains countries and citation count in each country
to obtain a full list of available countries, refer to the Locations endpoint
                languages object languages
contains languages and citation count in each language
to obtain a full list of available languages, refer to the Languages endpoint

‌‌