API Documentation

The Adblock Analytics API is a programming interface that allows you to directly access your account data at whatever interval you deem necessary. The primary use of the API is to extract your data via GET or POST requests so that you can create custom reports for your organization or to locally save your data history past 90 days which is the maximum duration for the dashboard reports.

Request via cURL

$ curl https://www.adblockanalytics.com/api/data/ \
-d key="signUpToReceiveYourApiKey" \
-d url="www.yourdomain.com" \
-d duration="yesterday" \
-d format="xml"

Request via PHP cURL

$request = curl_init();

curl_setopt($request, CURLOPT_URL, "https://www.adblockanalytics.com/api/data/");
curl_setopt($request, CURLOPT_POST, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, "key=signUpToReceiveYourApiKey&url=www.yourdomain.com&duration=yesterday&format=xml");
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($request);

curl_close($request);

echo $response;

Request via PHP HTTP GET

$request = "https://www.adblockanalytics.com/api/data/";
$request .= "?key=signUpToReceiveYourApiKey";
$request .= "&url=www.yourdomain.com";
$request .= "&duration=yesterday";
$request .= "&format=xml";

$response = file_get_contents($request);

echo $response;

Request Parameters

Item Type Required Length Accepted Values
key string yes 250 Sign up to receive your API key
url string yes 100 www.yourdomain.com
duration string yes 9 today, yesterday (default), 7days, 30days, 60days, 90days
devices string no 7 all (default), desktop, tablet, mobile
sections string no 8 all (default), traffic, platform, country
format string yes 4 xml (default), json

HTTP Response Codes

Code Name Description
200 Success Request was successful and a valid response was generated and returned.
403 Forbidden Unauthorized request was received and rejected.
500 Error Unexpected condition was encountered which prevented server from fulfilling the request.
503 Too Many Requests More than 1 request every 60 seconds was received. If you require a higher limit, please contact us.

Sample Request

$ curl https://www.adblockanalytics.com/api/data/ \
-d key="signUpToReceiveYourApiKey" \
-d url="www.yourdomain.com" \
-d duration="yesterday" \
-d format="xml"

Sample Response  (has visitor data for requested duration timeframe)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xml>
  <response>
    <account>
      <apiKey>signUpToReceiveYourApiKey</apiKey>
      <websites>
        <website>
          <name>Your Domain</name>
          <url>www.yourdomain.com</url>
          <lastVisitorProcessed>2017-08-21 00:20:36 America/New_York</lastVisitorProcessed>
          <summary>
            <duration>yesterday</duration>
            <visitors>4993</visitors>
            <visitorsAdsYes>4837</visitorsAdsYes>
            <visitorsAdsNo>156</visitorsAdsNo>
            <visitorsAdsYesPercent>96.88</visitorsAdsYesPercent>
            <visitorsAdsNoPercent>3.12</visitorsAdsNoPercent>
            <pageviews>30648</pageviews>
            <pageviewsAdsYes>29211</pageviewsAdsYes>
            <pageviewsAdsNo>1437</pageviewsAdsNo>
            <pageviewsAdsYesPercent>95.31</pageviewsAdsYesPercent>
            <pageviewsAdsNoPercent>4.69</pageviewsAdsNoPercent>
          </summary>
          <detail>
            <devices>
              <all>
                <traffic>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday">
                      <visitors>4993</visitors>
                      <visitorsAdsYes>4837</visitorsAdsYes>
                      <visitorsAdsNo>156</visitorsAdsNo>
                      <visitorsAdsYesPercent>96.88</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>3.12</visitorsAdsNoPercent>
                      <pageviews>30648</pageviews>
                      <pageviewsAdsYes>29211</pageviewsAdsYes>
                      <pageviewsAdsNo>1437</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>95.31</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>4.69</pageviewsAdsNoPercent>
                      <pagesVisit>6.14</pagesVisit>
                      <pagesVisitAdsYes>6.04</pagesVisitAdsYes>
                      <pagesVisitAdsNo>9.21</pagesVisitAdsNo>
                      <bounceRate>35.85</bounceRate>
                      <bounceRateAdsYes>36.10</bounceRateAdsYes>
                      <bounceRateAdsNo>28.21</bounceRateAdsNo>
                    </date>
                  </dates>
                </traffic>
                <platform>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" platform="Android" browser="Chrome">
                      <visitors>2029</visitors>
                      <visitorsAdsYes>2029</visitorsAdsYes>
                      <visitorsAdsNo>0</visitorsAdsNo>
                      <visitorsAdsYesPercent>100.00</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>0.00</visitorsAdsNoPercent>
                      <pageviews>11920</pageviews>
                      <pageviewsAdsYes>11920</pageviewsAdsYes>
                      <pageviewsAdsNo>0</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>100.00</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>0.00</pageviewsAdsNoPercent>
                      <pagesVisit>5.87</pagesVisit>
                      <pagesVisitAdsYes>5.87</pagesVisitAdsYes>
                      <pagesVisitAdsNo>0.00</pagesVisitAdsNo>
                      <bounceRate>34.35</bounceRate>
                      <bounceRateAdsYes>34.35</bounceRateAdsYes>
                      <bounceRateAdsNo>0.00</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </platform>
                <country>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" country="US" countryName="United States">
                      <visitors>4821</visitors>
                      <visitorsAdsYes>4676</visitorsAdsYes>
                      <visitorsAdsNo>145</visitorsAdsNo>
                      <visitorsAdsYesPercent>96.99</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>3.01</visitorsAdsNoPercent>
                      <pageviews>29964</pageviews>
                      <pageviewsAdsYes>28691</pageviewsAdsYes>
                      <pageviewsAdsNo>1273</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>95.75</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>4.25</pageviewsAdsNoPercent>
                      <pagesVisit>6.22</pagesVisit>
                      <pagesVisitAdsYes>6.14</pagesVisitAdsYes>
                      <pagesVisitAdsNo>8.78</pagesVisitAdsNo>
                      <bounceRate>35.30</bounceRate>
                      <bounceRateAdsYes>35.52</bounceRateAdsYes>
                      <bounceRateAdsNo>28.28</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </country>
              </all>
              <desktop>
                <traffic>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday">
                      <visitors>1258</visitors>
                      <visitorsAdsYes>1130</visitorsAdsYes>
                      <visitorsAdsNo>128</visitorsAdsNo>
                      <visitorsAdsYesPercent>89.83</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>10.17</visitorsAdsNoPercent>
                      <pageviews>9749</pageviews>
                      <pageviewsAdsYes>8518</pageviewsAdsYes>
                      <pageviewsAdsNo>1231</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>87.37</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>12.63</pageviewsAdsNoPercent>
                      <pagesVisit>7.75</pagesVisit>
                      <pagesVisitAdsYes>7.54</pagesVisitAdsYes>
                      <pagesVisitAdsNo>9.62</pagesVisitAdsNo>
                      <bounceRate>33.78</bounceRate>
                      <bounceRateAdsYes>34.42</bounceRateAdsYes>
                      <bounceRateAdsNo>28.13</bounceRateAdsNo>
                    </date>
                  </dates>
                </traffic>
                <platform>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" platform="Windows" browser="Chrome">
                      <visitors>436</visitors>
                      <visitorsAdsYes>371</visitorsAdsYes>
                      <visitorsAdsNo>65</visitorsAdsNo>
                      <visitorsAdsYesPercent>85.09</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>14.91</visitorsAdsNoPercent>
                      <pageviews>3905</pageviews>
                      <pageviewsAdsYes>3243</pageviewsAdsYes>
                      <pageviewsAdsNo>662</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>83.05</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>16.95</pageviewsAdsNoPercent>
                      <pagesVisit>8.96</pagesVisit>
                      <pagesVisitAdsYes>8.74</pagesVisitAdsYes>
                      <pagesVisitAdsNo>10.18</pagesVisitAdsNo>
                      <bounceRate>29.59</bounceRate>
                      <bounceRateAdsYes>30.46</bounceRateAdsYes>
                      <bounceRateAdsNo>24.62</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </platform>
                <country>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" country="US" countryName="United States">
                      <visitors>1162</visitors>
                      <visitorsAdsYes>1044</visitorsAdsYes>
                      <visitorsAdsNo>118</visitorsAdsNo>
                      <visitorsAdsYesPercent>89.85</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>10.15</visitorsAdsNoPercent>
                      <pageviews>9301</pageviews>
                      <pageviewsAdsYes>8224</pageviewsAdsYes>
                      <pageviewsAdsNo>1077</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>88.42</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>11.58</pageviewsAdsNoPercent>
                      <pagesVisit>8.00</pagesVisit>
                      <pagesVisitAdsYes>7.88</pagesVisitAdsYes>
                      <pagesVisitAdsNo>9.13</pagesVisitAdsNo>
                      <bounceRate>32.27</bounceRate>
                      <bounceRateAdsYes>32.76</bounceRateAdsYes>
                      <bounceRateAdsNo>27.97</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </country>
              </desktop>
              <tablet>
                <traffic>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday">
                      <visitors>361</visitors>
                      <visitorsAdsYes>353</visitorsAdsYes>
                      <visitorsAdsNo>8</visitorsAdsNo>
                      <visitorsAdsYesPercent>97.78</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>2.22</visitorsAdsNoPercent>
                      <pageviews>2944</pageviews>
                      <pageviewsAdsYes>2833</pageviewsAdsYes>
                      <pageviewsAdsNo>111</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>96.23</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>3.77</pageviewsAdsNoPercent>
                      <pagesVisit>8.16</pagesVisit>
                      <pagesVisitAdsYes>8.03</pagesVisitAdsYes>
                      <pagesVisitAdsNo>13.88</pagesVisitAdsNo>
                      <bounceRate>28.25</bounceRate>
                      <bounceRateAdsYes>28.90</bounceRateAdsYes>
                      <bounceRateAdsNo>0.00</bounceRateAdsNo>
                    </date>
                  </dates>
                </traffic>
                <platform>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" platform="iPad" browser="Safari">
                      <visitors>246</visitors>
                      <visitorsAdsYes>242</visitorsAdsYes>
                      <visitorsAdsNo>4</visitorsAdsNo>
                      <visitorsAdsYesPercent>98.37</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>1.63</visitorsAdsNoPercent>
                      <pageviews>2121</pageviews>
                      <pageviewsAdsYes>2031</pageviewsAdsYes>
                      <pageviewsAdsNo>90</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>95.76</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>4.24</pageviewsAdsNoPercent>
                      <pagesVisit>8.62</pagesVisit>
                      <pagesVisitAdsYes>8.39</pagesVisitAdsYes>
                      <pagesVisitAdsNo>22.50</pagesVisitAdsNo>
                      <bounceRate>31.30</bounceRate>
                      <bounceRateAdsYes>31.82</bounceRateAdsYes>
                      <bounceRateAdsNo>0.00</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </platform>
                <country>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" country="US" countryName="United States">
                      <visitors>338</visitors>
                      <visitorsAdsYes>330</visitorsAdsYes>
                      <visitorsAdsNo>8</visitorsAdsNo>
                      <visitorsAdsYesPercent>97.63</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>2.37</visitorsAdsNoPercent>
                      <pageviews>2855</pageviews>
                      <pageviewsAdsYes>2744</pageviewsAdsYes>
                      <pageviewsAdsNo>111</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>96.11</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>3.89</pageviewsAdsNoPercent>
                      <pagesVisit>8.45</pagesVisit>
                      <pagesVisitAdsYes>8.32</pagesVisitAdsYes>
                      <pagesVisitAdsNo>13.88</pagesVisitAdsNo>
                      <bounceRate>27.51</bounceRate>
                      <bounceRateAdsYes>28.18</bounceRateAdsYes>
                      <bounceRateAdsNo>0.00</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </country>
              </tablet>
              <mobile>
                <traffic>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday">
                      <visitors>3374</visitors>
                      <visitorsAdsYes>3354</visitorsAdsYes>
                      <visitorsAdsNo>20</visitorsAdsNo>
                      <visitorsAdsYesPercent>99.41</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>0.59</visitorsAdsNoPercent>
                      <pageviews>17955</pageviews>
                      <pageviewsAdsYes>17860</pageviewsAdsYes>
                      <pageviewsAdsNo>95</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>99.47</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>0.53</pageviewsAdsNoPercent>
                      <pagesVisit>5.32</pagesVisit>
                      <pagesVisitAdsYes>5.32</pagesVisitAdsYes>
                      <pagesVisitAdsNo>4.75</pagesVisitAdsNo>
                      <bounceRate>37.43</bounceRate>
                      <bounceRateAdsYes>37.42</bounceRateAdsYes>
                      <bounceRateAdsNo>40.00</bounceRateAdsNo>
                    </date>
                  </dates>
                </traffic>
                <platform>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" platform="Android" browser="Chrome">
                      <visitors>1960</visitors>
                      <visitorsAdsYes>1960</visitorsAdsYes>
                      <visitorsAdsNo>0</visitorsAdsNo>
                      <visitorsAdsYesPercent>100.00</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>0.00</visitorsAdsNoPercent>
                      <pageviews>11393</pageviews>
                      <pageviewsAdsYes>11393</pageviewsAdsYes>
                      <pageviewsAdsNo>0</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>100.00</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>0.00</pageviewsAdsNoPercent>
                      <pagesVisit>5.81</pagesVisit>
                      <pagesVisitAdsYes>5.81</pagesVisitAdsYes>
                      <pagesVisitAdsNo>0.00</pagesVisitAdsNo>
                      <bounceRate>34.80</bounceRate>
                      <bounceRateAdsYes>34.80</bounceRateAdsYes>
                      <bounceRateAdsNo>0.00</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </platform>
                <country>
                  <dates>
                    <date value="2017-08-20" dayOfWeek="Sunday" country="US" countryName="United States">
                      <visitors>3321</visitors>
                      <visitorsAdsYes>3302</visitorsAdsYes>
                      <visitorsAdsNo>19</visitorsAdsNo>
                      <visitorsAdsYesPercent>99.43</visitorsAdsYesPercent>
                      <visitorsAdsNoPercent>0.57</visitorsAdsNoPercent>
                      <pageviews>17808</pageviews>
                      <pageviewsAdsYes>17723</pageviewsAdsYes>
                      <pageviewsAdsNo>85</pageviewsAdsNo>
                      <pageviewsAdsYesPercent>99.52</pageviewsAdsYesPercent>
                      <pageviewsAdsNoPercent>0.48</pageviewsAdsNoPercent>
                      <pagesVisit>5.36</pagesVisit>
                      <pagesVisitAdsYes>5.37</pagesVisitAdsYes>
                      <pagesVisitAdsNo>4.47</pagesVisitAdsNo>
                      <bounceRate>37.16</bounceRate>
                      <bounceRateAdsYes>37.13</bounceRateAdsYes>
                      <bounceRateAdsNo>42.11</bounceRateAdsNo>
                    </date>
                    <!-- additional data has been removed to shorten response example -->
                  </dates>
                </country>
              </mobile>
            </devices>
          </detail>
        </website>
      </websites>
    </account>
  </response>
</xml>

Sample Response  (no visitor data for requested duration timeframe)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xml>
  <response>
    <account>
      <apiKey>signUpToReceiveYourApiKey</apiKey>
      <websites>
        <website>
          <name>Your Domain</name>
          <url>www.yourdomain.com</url>
          <lastVisitorProcessed>2017-08-21 00:20:36 America/New_York</lastVisitorProcessed>
          <summary>
            <duration>yesterday</duration>
            <visitors>0</visitors>
            <visitorsAdsYes>0</visitorsAdsYes>
            <visitorsAdsNo>0</visitorsAdsNo>
            <visitorsAdsYesPercent>0.00</visitorsAdsYesPercent>
            <visitorsAdsNoPercent>0.00</visitorsAdsNoPercent>
            <pageviews>0</pageviews>
            <pageviewsAdsYes>0</pageviewsAdsYes>
            <pageviewsAdsNo>0</pageviewsAdsNo>
            <pageviewsAdsYesPercent>0.00</pageviewsAdsYesPercent>
            <pageviewsAdsNoPercent>0.00</pageviewsAdsNoPercent>
          </summary>
        </website>
      </websites>
    </account>
  </response>
</xml>

Feedback

If you find any issues with this API, have suggestions on how it can be improved or have built something that you'd like to share, please do not hesitate to contact us.