Content Analysis – Category Trends API
This endpoint will provide you with data on all citations in the target category for the indicated date range.
This endpoint will provide you with data on all citations in the target category for the indicated date range.
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( "category_code" => 10994, "search_mode" => "as_is", "date_from" => "2022-09-01", "date_group" => "month" ); try { // POST /v3/content_analysis/category_trends/live $result = $client->post('/v3/content_analysis/category_trends/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": "19.4363 sec.", "cost": 0.02009, "tasks_count": 1, "tasks_error": 0, "tasks": [ { "id": "11091159-1535-0467-0000-7de6f8a2cd19", "status_code": 20000, "status_message": "Ok.", "time": "19.3880 sec.", "cost": 0.02009, "result_count": 3, "path": [ "v3", "content_analysis", "phrase_trends", "live" ], "data": { "api": "content_analysis", "function": "phrase_trends", "keyword": "logitech", "search_mode": "as_is", "date_from": "2022-09-01", "date_group": "month" }, "result": [ { "type": "content_analysis_trends", "date": "2022-09-01", "total_count": 1159252, "rank": 590, "top_domains": [ { "domain": "xsplit.com", "count": 53678 }, { "domain": "englishsteps.net", "count": 26359 }, { "domain": "wireless1.com.au", "count": 13768 }, { "domain": "16bars.de", "count": 8075 }, { "domain": "bcoolmagazin.hu", "count": 7615 }, { "domain": "maistecnologia.com", "count": 6352 }, { "domain": "seattlestreetcar.org", "count": 5923 }, { "domain": "dutchcreativeindustry.com", "count": 5891 }, { "domain": "reviewsguide.org", "count": 4195 } ], "sentiment_connotations": { "anger": 33, "happiness": 32457, "love": 4976, "sadness": 290, "share": 33841, "fun": 1212 }, "connotation_types": { "positive": 390289, "negative": 135916, "neutral": 589516 }, "text_categories": [ { "category": null, "count": 138579 }, { "category": [ 10013, 10019, 10167 ], "count": 112695 }, { "category": [ 10019, 10167, 10007, 13418 ], "count": 55421 }, { "category": [ 10019, 10167, 10013 ], "count": 50413 }, { "category": [ 10013, 10108, 13691 ], "count": 47466 }, { "category": [ 10013, 10004 ], "count": 31977 }, { "category": [ 10013, 10108 ], "count": 29651 }, { "category": [ 10013, 10108, 10584 ], "count": 20540 }, { "category": [ 10108, 13691, 10013, 10103, 10556 ], "count": 19429 }, { "category": [ 10004, 10013 ], "count": 16576 } ], "page_categories": [ { "category": null, "count": 297216 }, { "category": [ 10014, 10114, 10108 ], "count": 54264 }, { "category": [ 10013, 10108, 10584 ], "count": 24245 }, { "category": [ 10013, 10019, 10167 ], "count": 12532 }, { "category": [ 10108, 10584, 10013 ], "count": 11249 }, { "category": [ 10019, 10167, 10013 ], "count": 9711 }, { "category": [ 10019, 10167, 10009, 10404 ], "count": 7441 }, { "category": [ 10013, 10108 ], "count": 7435 }, { "category": [ 10108, 10013 ], "count": 6574 }, { "category": [ 10013, 10021, 10176, 13779 ], "count": 6109 } ], "page_types": { "blogs": 622032, "organization": 118086, "news": 230980, "message-boards": 18590, "ecommerce": 96451 }, "countries": { "US": 86504, "WW": 56826, "DE": 30522, "IN": 21831, "VN": 20049, "AU": 19544, "BR": 16685, "JP": 16651, "GB": 16405, "ES": 15335 }, "languages": { "en": 712751, "ja": 114912, "de": 63841, "es": 60616, "fr": 53833, "it": 27394, "vi": 23817, "ru": 16528, "pt": 11518, "hu": 8393 } }, { "type": "content_analysis_trends", "date": "2022-10-01", "total_count": 1430023, "rank": 613, "top_domains": [ { "domain": "vdsitsolutions.com", "count": 341567 }, { "domain": "dutchcreativeindustry.com", "count": 34616 }, { "domain": "wireless1.com.au", "count": 25600 }, { "domain": "richardcastle.net", "count": 8217 }, { "domain": "edenred.mx", "count": 8196 }, { "domain": "private-sextreffen.cc", "count": 7867 }, { "domain": "parkkitchen.com", "count": 7406 }, { "domain": "16bars.de", "count": 7337 }, { "domain": "x-kom.pl", "count": 7001 }, { "domain": "kreativdesign1.de", "count": 6131 } ], "sentiment_connotations": { "anger": 9, "happiness": 36007, "love": 4062, "sadness": 128, "share": 52651, "fun": 971 }, "connotation_types": { "positive": 735206, "negative": 175341, "neutral": 468693 }, "text_categories": [ { "category": [ 10019, 10167, 10168, 10883, 12184, 10007, 11506, 12168 ], "count": 262712 }, { "category": null, "count": 119642 }, { "category": [ 10019, 10167, 10872, 10007, 11506, 12168 ], "count": 66173 }, { "category": [ 10001, 10024, 10185, 10952, 13573 ], "count": 31464 }, { "category": [ 10013, 10019, 10167 ], "count": 22904 }, { "category": [ 10013, 10019, 10167, 10108, 13691 ], "count": 22363 }, { "category": [ 10013, 10108, 13691 ], "count": 21340 }, { "category": [ 10019, 10168, 10886, 12222, 12216, 10108 ], "count": 19754 }, { "category": [ 10108, 10001, 13655, 13656, 10016, 10139, 10746 ], "count": 19439 }, { "category": [ 10019, 10167, 10013, 10007, 13418 ], "count": 17741 } ], "page_categories": [ { "category": null, "count": 213366 }, { "category": [ 10108, 13647, 10013, 10105, 13536, 10566, 13897, 13700 ], "count": 24725 }, { "category": [ 10013, 10108, 10584 ], "count": 18093 }, { "category": [ 10009, 10404, 10004, 13804 ], "count": 9602 }, { "category": [ 10108, 10584, 10013 ], "count": 8787 }, { "category": [ 10108, 13647, 13700 ], "count": 7707 }, { "category": [ 10013, 10019, 10167 ], "count": 7074 }, { "category": [ 10019, 10167, 10013 ], "count": 6302 }, { "category": [ 10009, 10404, 10019, 10167, 10017, 10142, 10769, 12067 ], "count": 5648 }, { "category": [ 10019, 10167, 10007, 10878, 13381, 12161, 13054 ], "count": 5625 } ], "page_types": { "blogs": 809466, "organization": 44189, "news": 256351, "message-boards": 26910, "ecommerce": 137036 }, "countries": { "BE": 344693, "US": 90030, "WW": 68847, "DE": 42458, "AU": 32590, "VN": 24763, "PL": 21004, "IN": 19569, "BR": 18502, "MX": 14819 }, "languages": { "en": 963542, "ja": 112659, "de": 82151, "es": 80681, "fr": 57705, "vi": 33349, "it": 25147, "pl": 9751, "nl": 6994, "nb": 6684 } }, { "type": "content_analysis_trends", "date": "2022-11-01", "total_count": 130203, "rank": 462, "top_domains": [ { "domain": "vdsitsolutions.com", "count": 42547 }, { "domain": "dutchcreativeindustry.com", "count": 3444 }, { "domain": "maistecnologia.com", "count": 3342 }, { "domain": "wireless1.com.au", "count": 2942 }, { "domain": "gamersco.com", "count": 1604 }, { "domain": "edenred.mx", "count": 1031 }, { "domain": "dateks.lv", "count": 792 }, { "domain": "insidecee.pl", "count": 640 }, { "domain": "1001buonisconto.it", "count": 595 }, { "domain": "qasgk.com", "count": 504 } ], "sentiment_connotations": { "anger": 0, "happiness": 6607, "love": 236, "sadness": 8, "share": 4486, "fun": 1595 }, "connotation_types": { "positive": 76016, "negative": 20227, "neutral": 24780 }, "text_categories": [ { "category": [ 10019, 10167, 10168, 10883, 12184, 10007, 11506, 12168 ], "count": 42547 }, { "category": null, "count": 11482 }, { "category": [ 10013, 10019, 10168, 10886, 12216, 10167 ], "count": 3365 }, { "category": [ 10007, 13418, 10019, 10167, 10873, 12138, 10168, 10885, 12204 ], "count": 3132 }, { "category": [ 10019, 10168, 10883, 12187, 10167, 10886, 12216 ], "count": 2938 }, { "category": [ 10019, 10168, 10886, 12216, 12222, 10007, 13418 ], "count": 1610 }, { "category": [ 10013, 10019, 10167, 10108, 13691 ], "count": 1609 }, { "category": [ 10013, 10108, 13691 ], "count": 1335 }, { "category": [ 10019, 10167, 10013, 10007, 13418 ], "count": 1276 }, { "category": [ 10019, 10167, 10013, 10108, 13691 ], "count": 1219 } ], "page_categories": [ { "category": null, "count": 23050 }, { "category": [ 10108, 13647, 10013, 10105, 13536, 10566, 13897, 13700 ], "count": 3444 }, { "category": [ 10108, 10756, 10013 ], "count": 1607 }, { "category": [ 10019, 10167, 10013, 10007, 13418 ], "count": 834 }, { "category": [ 10009, 10404, 10004, 13804 ], "count": 627 }, { "category": [ 10013, 10108, 10584 ], "count": 578 }, { "category": [ 13575, 13441, 13860 ], "count": 470 }, { "category": [ 10108, 13691, 10013, 10103, 10556 ], "count": 446 }, { "category": [ 10009, 10404, 10019, 10167, 10017, 10142, 10769, 12067 ], "count": 386 }, { "category": [ 10013, 10019, 10167, 10007, 13418 ], "count": 375 } ], "page_types": { "blogs": 78908, "organization": 6034, "news": 18164, "message-boards": 5147, "ecommerce": 12120 }, "countries": { "BE": 42874, "WW": 9893, "US": 5008, "AU": 3524, "DE": 1722, "IN": 1630, "PL": 1570, "FR": 1482, "MX": 1457, "VN": 1441 }, "languages": { "en": 90074, "es": 7246, "ja": 5861, "de": 5095, "pt": 4022, "vi": 3981, "fr": 3344, "pl": 2044, "it": 1927, "nb": 1311 } } ] } ] }
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.
You can specify the number of results you want to retrieve, filter and sort them.
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 |
---|---|---|
category_code |
string | target category code required field to obtain a full list of available categories, refer to the Categories endpoint |
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" |
search_mode |
string | results grouping type optional field possible grouping types: as_is – returns data on all citations for the target category_code one_per_domain – returns data on one citation of the category_code per domaindefault value: as_is |
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 |
date_from |
string | starting date of the time range required field date format: "yyyy-mm-dd" example: "2019-01-15" |
date_to |
string | ending date of the time range optional field if you don’t specify this field, today’s date will be used by default date format: "yyyy-mm-dd" example: "2019-01-15" |
date_group |
string | time range which will be used to group the results optional field default value: month possible values: day , week , month |
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 conditionsthe following operators are supported: regex , not_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 charactersexample: ["domain","<>", "logitech.com"]
|
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_trends’ |
date |
string | date for which the data is provided |
total_count |
integer | total number 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 for the given date |
top_domains |
array | top domains citing the target keyword contains objects with top domains citing the target category and citation count per each domain |
sentiment_connotations |
object | sentiment connotations contains sentiments (emotional reactions) related to the target category citation and the number of citations per each sentiment possible connotations: "anger" , "fear" , "happiness" , "love" , "sadness" , "share" , "neutral" , "fun" |
connotation_types |
object | connotation types contains types of sentiments (sentiment polarity) related to the category 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 |