Featured image for SERP API v3 update: "target_rankings" array is removed

The “target_rankings” array is removed. The changes went live on March 4.

Basically, the “target_rankings” array selected the search results with a website URL you have specified and duplicated the matched elements from SERP into this array.

Why are we removing this array?

Well, in short, it does not make sense anymore, and only doubles developers’ efforts.

Providing particular website rankings from our end works well until search engine results are not overwhelmed with SERP features, and have only one targeted result. When it comes to plenty of rich snippets, the specified URL might match a dozen of them, and the “targetrankings” array will be filled with tons of duplicated data.

It necessities the processing, filtering, and retrieving duplicated data from an extra array instead of logical pulling it directly from top 100 results without any problems. So, the extra array only amplifies the work.

Can you still retrieve specific website rankings?

Sure enough, you can. SERP API results are provided in a structured JSON-encoded array which allows you to simply navigate, filter, and parse it according to your needs. It’s a 5-minute job for a decent developer to write a tailor-made script that will run a loop for the “items” array to identify a necessary search result.

Furthermore, from our experience, it’s better to create this custom script and pull the data directly this way, you will be sure the results are highly relevant to your use case.

Our developers have prepared a sample of the script you can use to retrieve particular website rankings. We think the shortest way is the following:

  • Set a task to the SERP API using the corresponding endpoint:
    POST https://api.dataforseo.com/v3/serp/google/organic/task_post

  • Specify the ‘pingback_url’ parameter with your server address in the POST array to be notified once task is completed.

  • Specify the website or URL you would like to get the positions for in the ‘tag’ parameter.

        "language_name": "English",
        "location_name": "United States",
        "keyword": "albert einstein",
        "tag": "wikipedia.org",
        "pingback_url": "https://your-server.com/pingback.php?id=$id"

If you specified the “pingback_url” we will send over the “id” of the task as soon as it is completed.

By this link you can download a sample pingback_url script, which contains a part of code that helps you to get particular organic website rankings. The script runs a loop and extracts the URLs that match the website you specified in the “tag” parameter.
In other words, it helps to check every element from the “items” array, every listed webpage returned from SERP, and find the ranking you are looking for.

The part of code mentioned above has the following structure:

                    //we set 'site' value when setting the task
                    if ((isset($task['data']['tag'])) and (!empty($task['data']['tag']))) {
                        $site = $task['data']['tag'];
                        foreach($task['result']['items'] as $serp) {
                            //looking only for organics
                            if (($serp['type'] == 'organic') and (parse_url($serp['url'], PHP_URL_HOST) == $site)) {
                                $result[] = $serp;

This way you will be able to retrieve the rankings of a specific website in SERP.

If you are using SERP API Advanced functions, you probably need to retrieve the SERP features positions as well. If you’d like to do that, you need to change the type of results from 'organic' to another, for example 'local_pack', 'featured_snippet', 'carousel', etc.

Note that the way explained above is only a recommendation and sample path to do the job. Everything depends on the way you retrieve the results, your use case, and your convenience.

If you have any questions drop a line to our friendly support team. They will help you to understand the changes and provide you with all technical assistance and integration support.

Below you will find the examples of the updated response structure.