NAV Navbar
Logo
php python csharp java

Competitor Data API

Competitor API will provide you with information about your competitors.

The time to retrieve the result is up to 30 seconds.

Competitor Info

Instead of ‘login’ and ‘password’ use your credentials from https://my.dataforseo.com/login

<?php
require('RestClient.php');
//You can download this file from here https://api.dataforseo.com/_examples/php/_php_RestClient.zip

try {

    //Instead of 'login' and 'password' use your credentials from https://my.dataforseo.com/login
    $client = new RestClient('https://api.dataforseo.com/', null, 'login', 'password');

    $cmp_get_result = $client->get('v2/cmp_get/asana.com');
    print_r($cmp_get_result);

    //do something with results

} 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";
    exit();
}

$client = null;
?>
from client import RestClient
#You can download this file from here https://api.dataforseo.com/_examples/python/_python_Client.zip

#Instead of 'login' and 'password' use your credentials from https://my.dataforseo.com/login
client = RestClient("login", "password")
domain = "asana.com"
response = client.get("/v2/cmp_get/%s" % (domain))
if response["status"] == "error":
    print("error. Code: %d Message: %s" % (response["error"]["code"], response["error"]["message"]))
else:
    print(response["results"])
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace DataForSeoDemos
{
    public static partial class Demos
    {
        public static async Task cmp_get()
        {
            var httpClient = new HttpClient
            {
                BaseAddress = new Uri("https://api.dataforseo.com/"),

                //Instead of 'login' and 'password' use your credentials from https://my.dataforseo.com/login
                DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes("login:password"))) }
            };
            var domain = "asana.com";
            var response = await httpClient.GetAsync($"v2/cmp_get/{domain}");
            var obj = JsonConvert.DeserializeObject<dynamic>(await response.Content.ReadAsStringAsync());
            if (obj.status == "error")
                Console.WriteLine($"error. Code: {obj.error.code} Message: {obj.error.message}");
            else
            {
                foreach (var result in obj.results)
                    Console.WriteLine(result);
            }
        }
    }
}
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.util.*;

public class Demos {
    public static void cmp_get() throws JSONException, IOException {
        HttpClient client;
        client = HttpClientBuilder.create().build();
        String domain = "asana.com";
        HttpGet get = new HttpGet("https://api.dataforseo.com/v2/cmp_get/" + domain);
        //Instead of 'login' and 'password' use your credentials from https://my.dataforseo.com/login
        String basicAuth = Base64.getEncoder().encodeToString(("login:password").getBytes("UTF-8"));

        get.setHeader("Content-type", "application/json");
        get.setHeader("Authorization", "Basic " + basicAuth);
        HttpResponse kwrdResponse = client.execute(get);
        JSONObject kwrdObj = new JSONObject(EntityUtils.toString(kwrdResponse.getEntity()));

        if (kwrdObj.get("status").equals("error")) {
            System.out.println("error. Code:" + kwrdObj.getJSONObject("error").get("code") + " Message: " + kwrdObj.getJSONObject("error").get("message"));
        } else {
            JSONArray results = kwrdObj.getJSONArray("results");
            for (int i = 0; i < results.length(); i++) {
                System.out.println(results.get(i));
            }
        }
    }
}

The above command returns JSON structured like this:

{
    "status": "ok",
    "results_time": "0.6756 sec.",
    "results_count": 1,
    "results": [
        {
            "date": "2017-01-01",
            "site_url": "asana.com",
            "site_title": "Use Asana to track your team’s work & manage projects · Asana",
            "site_description": "It’s free to use, simple to get started, and powerful enough to run your entire business. Sign up for free today.",
            "audience": {
                "visits": 19952871,
                "time_on_site_avg": "00:09:25",
                "page_views_avg": 6.9773123942789,
                "bounce_rate": 35.85
            },
            "traffic": {
                "value": 19952871,
                "percent": 100,
                "countries": [
                    {
                        "country": "United States",
                        "value": 6864349,
                        "percent": 34.4
                    },
                    {
                        "country": "United Kingdom",
                        "value": 1133338,
                        "percent": 5.68
                    },
                    {
                        "country": "Brazil",
                        "value": 705693,
                        "percent": 3.54
                    },
                    {
                        "country": "Canada",
                        "value": 703566,
                        "percent": 3.53
                    },
                    {
                        "country": "Poland",
                        "value": 700182,
                        "percent": 3.51
                    },
                    {
                        "country": "Other",
                        "value": 984474655,
                        "percent": 49.34
                    }
                ],
                "sources": {
                    "direct": {
                        "value": 11200942,
                        "percent": 56.14
                    },
                    "search_organic": {
                        "value": 1516235,
                        "percent": 7.6,
                        "top_keywords": [
                            {
                                "keyword": "asana",
                                "value": 1137732,
                                "percent": 75.04
                            },
                            {
                                "keyword": "asana app",
                                "value": 13908,
                                "percent": 0.92
                            },
                            {
                                "keyword": "independent director positions",
                                "value": 8174,
                                "percent": 0.54
                            },
                            {
                                "keyword": "poczta kwiatkowskiego 2b rzeszow",
                                "value": 7422,
                                "percent": 0.49
                            },
                            {
                                "keyword": "setting yourself up for acquisition",
                                "value": 6074,
                                "percent": 0.4
                            }
                        ]
                    },
                    "search_ad": {
                        "value": 101983,
                        "percent": 0.51,
                        "top_keywords": [
                            {
                                "keyword": "asana",
                                "value": 67707,
                                "percent": 66.39
                            },
                            {
                                "keyword": "timeline",
                                "value": 1288,
                                "percent": 1.26
                            },
                            {
                                "keyword": "to do list",
                                "value": 1181,
                                "percent": 1.16
                            },
                            {
                                "keyword": "task manager",
                                "value": 793,
                                "percent": 0.78
                            },
                            {
                                "keyword": "assana",
                                "value": 779,
                                "percent": 0.76
                            }
                        ]
                    },
                    "referral": {
                        "value": 4479578,
                        "percent": 22.45,
                        "top_referrals": [
                            {
                                "site": "blog.capterra.com",
                                "value": 204328,
                                "percent": 4.56
                            },
                            {
                                "site": "instagantt.com",
                                "value": 189092,
                                "percent": 4.22
                            },
                            {
                                "site": "news.ycombinator.com",
                                "value": 177579,
                                "percent": 3.96
                            },
                            {
                                "site": "github.com",
                                "value": 116090,
                                "percent": 2.59
                            },
                            {
                                "site": "symbaloo.com",
                                "value": 115508,
                                "percent": 2.58
                            }
                        ]
                    },
                    "referral_ad": {
                        "value": 8640,
                        "percent": 0.04,
                        "top_referrals": [
                            {
                                "site": "nytimes.com",
                                "value": 3173,
                                "percent": 36.73
                            },
                            {
                                "site": "recode.net",
                                "value": 1586,
                                "percent": 18.37
                            },
                            {
                                "site": "thenextweb.com",
                                "value": 1057,
                                "percent": 12.24
                            },
                            {
                                "site": "youtube.com",
                                "value": 881,
                                "percent": 10.2
                            },
                            {
                                "site": "inbox.google.com",
                                "value": 352,
                                "percent": 4.08
                            }
                        ]
                    },
                    "social": {
                        "value": 672103,
                        "percent": 3.37,
                        "top_socials": [
                            {
                                "site": "Facebook",
                                "value": 356595,
                                "percent": 53.06
                            },
                            {
                                "site": "Youtube",
                                "value": 135141,
                                "percent": 20.11
                            },
                            {
                                "site": "WhatsApp Webapp",
                                "value": 50327,
                                "percent": 7.49
                            },
                            {
                                "site": "Twitter",
                                "value": 34339,
                                "percent": 5.11
                            },
                            {
                                "site": "Linkedin",
                                "value": 24925,
                                "percent": 3.71
                            }
                        ]
                    },
                    "appstore": {
                        "value": 0,
                        "percent": 0,
                        "top_apps": [
                            {
                                "app_id": "com.asana.app",
                                "app_title": "Asana: Team Tasks & Projects",
                                "app_author": "Asana, Inc.",
                                "app_category": "Business",
                                "app_price": "Free",
                                "app_rating": 4.1412091255188,
                                "app_rating_count": 15948
                            },
                            {
                                "app_id": "489969512",
                                "app_title": "Asana: Team Tasks & Conversations",
                                "app_author": "Asana, Inc.",
                                "app_category": "Business",
                                "app_price": "0.0 EGP",
                                "app_rating": 4,
                                "app_rating_count": 2666
                            },
                            {
                                "app_id": "1175204125",
                                "app_title": "Answers For Lego Heroes Trivia Photo Games Pro",
                                "app_author": "Sukanda Tualek",
                                "app_category": "Games",
                                "app_price": "1.99 USD",
                                "app_rating": 0,
                                "app_rating_count": 0
                            }
                        ]
                    },
                    "mail": {
                        "value": 1973386,
                        "percent": 9.89
                    }
                },
                "estimated": {
                    "2016-08-01": 21392337,
                    "2016-09-01": 20358683,
                    "2016-10-01": 20588723,
                    "2016-11-01": 19146635,
                    "2016-12-01": 17345915,
                    "2017-01-01": 19952871
                }                
            },
            "sites": {
                "similar_sites": [
                    {
                        "site": "trello.com",
                        "rank": 342
                    },
                    {
                        "site": "basecamp.com",
                        "rank": 2790
                    },
                    {
                        "site": "ca.linkedin.com",
                        "rank": 9223372036854775807
                    },
                    {
                        "site": "twitter.com",
                        "rank": 7
                    },
                    {
                        "site": "producteev.com",
                        "rank": 71125
                    },
                    {
                        "site": "github.com",
                        "rank": 72
                    },
                    {
                        "site": "mercurynews.com",
                        "rank": 6179
                    },
                    {
                        "site": "irritantis.info",
                        "rank": 3027363
                    },
                    {
                        "site": "crunchbase.com",
                        "rank": 4520
                    },
                    {
                        "site": "hitask.com",
                        "rank": 373610
                    }
                ],
                "similar_sites_by_rank": [
                    {
                        "site": "google.com",
                        "rank": 1
                    },
                    {
                        "site": "twitter.com",
                        "rank": 7
                    },
                    {
                        "site": "github.com",
                        "rank": 72
                    },
                    {
                        "site": "quora.com",
                        "rank": 111
                    },
                    {
                        "site": "trello.com",
                        "rank": 342
                    },
                    {
                        "site": "lifehacker.com",
                        "rank": 1278
                    },
                    {
                        "site": "techcrunch.com",
                        "rank": 2534
                    },
                    {
                        "site": "basecamp.com",
                        "rank": 2790
                    },
                    {
                        "site": "crunchbase.com",
                        "rank": 4520
                    },
                    {
                        "site": "mercurynews.com",
                        "rank": 6179
                    }
                ]
            }            
        }
    ]
}

This feature will provide you with information about traffic and its sources, as well as visits analysis of your competitors websites.

The receiving of information is made by GET method with such parameters:

Name of a field Type Description
domain string domain
required field

As a response of API server you will receive JSON array in the field results of which there will be data for the competitor domain.

Name of a field Type Description
status string general result
“ok” - successful
“error” - error
if status=“error”, then you will be able to see more detailed information about array error error
error array informational array of error
only if status=“error”
the list of possible errors can be found below.
      code integer error code
      message string text description of an error
results_time string execution time, seconds
results_count string number of elements in the array of results
results array array of results
      date string month when the information was received
in the format “year-month-date”
all information provided for this month
      site_url string domain URL
      site_title string main page ‘Title’ metatag
      site_description string main page ‘Description’ metatag
      audience array audience information
         visits integer total visits
         time_on_site_avg string average visit duration
         page_views_avg string average page views by visit
         bounce_rate string bounce rate
      traffic array traffic information
         value integer total traffic value
         percent float total traffic percentage
         countries array traffic by countries
            country string country
            value integer traffic value
            percent float traffic percentage
         sources array traffic sources
            direct array direct source
               value integer traffic value
               percent float traffic percentage
            search_organic array organic search
               value integer traffic value
               percent float traffic percentage
               top_keywords array top 5 organic search keywords
                  keyword string search keyword
                  value integer organic search value
                  percent float organic search percentage
            search_ad array paid search
               value integer traffic value
               percent float traffic percentage
               top_keywords array top 5 keywords
                  keyword string keyword
                  value integer paid search value
                  percent float paid search percentage
            referral array top referring sites
               value integer traffic value
               percent float traffic percentage
               top_referrals array top 5 referring sites
                  site string site
                  value integer referral traffic value
                  percent float referral traffic percentage
            referral_ad array advertising publishers
               value integer traffic value
               percent float traffic percentage
               top_referrals array top 5 publishers
                  site string site
                  value integer advertising referral traffic value
                  percent float advertising referral traffic percentage
            social array traffic from social media
               value integer traffic value
               percent float traffic percentage
               top_socials array top socials
                  site string social
                  value integer social traffic value
                  percent float social traffic percentage
            appstore array related apps
               value integer traffic value
               percent float traffic percentage
               top_apps array top applications
                  app_id string application ID
                  app_title string application title
                  app_author string application author
                  app_category string application category
                  app_price string application price
                  app_rating string application rating
                  app_rating_count string application rating count
            mail array source
               value integer traffic value
               percent float traffic percentage
         estimated array estimated traffic by months
            $month integer this month estimated traffic value
      sites array list of websites that have similar content or rank
         similar_sites array domains of websites with content similar to the specified site
they may share the same audience, compete on the same keywords, сommon links to and from the compared sites, share similar content
            site string site
            rank integer domain rank
the less a number is the higher rank a website has
         similar_sites_by_rank array domains of websites that are ranked based on SimilarWeb algorithm
            site string site
            rank integer domain rank
the less a number is the higher rank a website has