Web Stats API

API documentation

Take your web stats with you. Put them on your website, in your application, or turn them into a desktop widget. The W3Counter Web Stats API makes it all easy — a simple URL-based interface and web standard XML responses. The API is so comprehensive, the web stats you get from the W3Counter website are built on it.

Availability

The Web Stats API is available to Personal and higher accounts. Personal accounts get access to the Essentials API — total visit and pageview counts for all their websites, as well as breakdowns by date going back to the registration date of the account.

Plus and Pro accounts have access to the full Pro API, providing all the detailed statistics you get through the W3Counter website.

Authentication

Access to your web stats through the API is controlled with an API key which must be sent with every request. To obtain your API key, sign in to your account, click "My Account" at the top of the page, then click "API" in the menu. This key will automatically be updated whenever you change your account password for security purposes.

Each request must also include a website ID, which identifies the site you want statistics for. This is the ID from the tracking code you added to your websites, and is also shown in the URL whenever you're viewing your web stats.

Making API Calls

A call to the W3Counter Web Stats API is as simple as accessing the following URL in your application:

http://api.w3counter.com/v4api.php

Append to that API the name of the function you wish to access and the parameters for that function as listed in the specification below. For example, to request the locations of the last 20 visitors to website #123, you would retrieve the following URL:

http://api.w3counter.com/v4api.php?&key=[apikey]&func=getVisitorsLocations&website_id=123&limit=20&offset=0

Any time a date is required, it should be provided in YYYY-MM-DD format.

Essentials API Reference

getSummaryByDay (website_id, start_date, end_date, limit, offset)

Returns visit and page view counts for a website grouped by date.
website_id: ID of the website
start_date: Start of the date range
end_date: End of the date range
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSummaryTotals (website_id)

Returns total number of visits, return visits and page views recorded for a website.
website_id: ID of the website

getSummaryByWeek (website_id, start_date, end_date, limit, offset)

Returns visit and page view counts for a website grouped by week.
website_id: ID of the website
start_date: Start of the date range
end_date: End of the date range
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSummaryByMonth (website_id, start_date, end_date, limit, offset)

Returns visit and page view counts for a website grouped by month.
website_id: ID of the website
start_date: Start of the date range
end_date: End of the date range
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

Pro API Reference

getUniqueVisits (website_id)

Returns the number of unique visits to the website in the visitor log.
website_id: ID of the website

getPageViews (website_id)

Returns the number of page views of the website in the visitor log.
website_id: ID of the website

getDashboardData (website_id)

website_id:

getVisitorsLocationsCount (website_id)

Returns the number of unique countries of visitors to a website.
website_id: ID of the website

getVisitorsLocations (website_id, limit, offset)

Returns the locations of visitors to a website grouped by country.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getRecentLocations (website_id, limit)

Returns the locations of the most recent visitors to a website.
website_id: ID of the website
limit: Maximum number of records to return

getVisitorsLanguagesCount (website_id)

Returns the number of unique languages of visitors to a website.
website_id: ID of the website

getUniqueVisitsWithLanguages (website_id)

website_id:

getVisitorsLanguages (website_id, limit, offset)

Returns the visits to a website grouped by language.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getVisitDepth (website_id)

Returns the depths of visits to a website (number of pages viewed per session).
website_id: ID of the website

getVisitLength (website_id)

Returns the time in seconds of visits to a website grouped by interval.
website_id:

getClickList (website_id, url, limit, offset)

Returns a list of URLs clicked from a specific URL ordered by number of clicks.
website_id: ID of the website
url: Origin page to retrieve a click list for
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getReferrersTopCount (website_id)

Returns the number of distinct referrers to a website.
website_id: ID of the website

getReferrersTop (website_id, limit, offset)

Returns the referrers to a website ordered by number of referred visits.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getReferrersDomainsCount (website_id)

Returns the number of distinct domains referring visits to a website.
website_id: ID of the website

getReferrersDomains (website_id, limit, offset)

Returns the domains referring visits to a website ordered by the number of visits.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getReferrersDrilldown (website_id, domain)

Returns the individual pages within a domain referring visits to a website.
website_id: ID of the website
domain: Domain of referring visits to retrieve complete URL list for

getReferrersNew (website_id, limit, offset)

Returns referring URLs that haven't referred visits before the current date.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getReferrersRecent (website_id, limit, offset)

Returns the most recent referring URLs to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSearchesTopCount (website_id)

Returns the number of unique search phrases referring visits to a website.
website_id: ID of the website

getSearchesTop (website_id, limit, offset)

Returns the search phrases referring visits to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSearchesWithSETopCount (website_id)

Returns the number of search engine and search phrase combinations referring visits to a website.
website_id: ID of the website

getSearchesWithSETop (website_id, limit, offset)

Returns the unique search engine and search phrase combinations referring visits to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSearchesNew (website_id, limit, offset)

Returns search phrases that haven't referred visits before the current date.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSearchesRecent (website_id, limit, offset)

Returns the most recent search phrases to refer visits to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getSearchEnginesCount (website_id)

Returns the number of unique search engines referring visits to a website.
website_id: ID of the website

getSearchEngines (website_id, limit, offset)

Returns the search engines referring visits to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getBrowsersTopCount (website_id)

Returns the number of unique browsers used by visitors to a website.
website_id: ID of the website

getBrowsersTop (website_id, limit, offset)

Returns the browsers used by visitors to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getBrowsersFamilyCount (website_id)

Returns the number of distinct browser families used by visitors to a website.
website_id: ID of the website

getBrowsersFamily (website_id, limit, offset)

Returns the browser families used by visitors to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getBrowserDrilldown (website_id, family)

Returns the specific versions within a browser family used by visitors to a website.
website_id: ID of the website
family: Browser family (i.e. IE, Firefox, Opera)

getPlatformsCount (website_id)

Returns the number of unique operating systems used by visitors to a website.
website_id: ID of the website

getPlatforms (website_id, limit, offset)

Returns the operating systems used by visitors to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getDisplayResolutionsCount (website_id)

Returns the number of unique screen resolutions used by visitors to a website.
website_id: ID of the website

getDisplayResolutions (website_id, limit, offset)

Returns the display resolutions used by visitors to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getDisplayDepthsCount (website_id)

Returns the number of unique screen color depths used by visitors to a website.
website_id: ID of the website

getDisplayDepths (website_id, limit, offset)

Returns the screen color depths used by visitors to a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getJavaScriptCounts (website_id)

Returns the number of visitors with javascript enabled or disabled for a website.
website_id: ID of the website

getVisitorsOnline (website_id, limit, offset)

Returns the visitors currently active on a website.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getVisitorsRecent (website_id, limit, offset)

Returns the visitors active on the website on this date.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getVisitorDrilldown (website_id, visitor_id)

Returns the visit log entries for a specific visitor id.
website_id: ID of the website
visitor_id: ID of a visitor taken from the results of a call to getVisitorsOnline or getVisitorsRecent

getPageCount (website_id)

Returns the number of distinct webpages for a website.
website_id: ID of the website

getPagesPopular (website_id, limit, offset)

Returns the pages of a website in order of number of views.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getPagesEntryCount (website_id)

Returns the number of distinct entry pages to a website.
website_id: ID of the website

getPagesEntry (website_id, limit, offset)

Returns the pages of a website which served as entry points to the site.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getPagesExit (website_id, limit, offset)

Returns the pages of a website which were the last viewed page in visit sessions.
website_id: ID of the website
limit: Maximum number of records to return
offset: Number of records to skip before the first returned

getVisitsByHour (website_id, date)

Returns the number of unique visits grouped by hour for a specific date. Only recent dates may be available.
website_id: ID of the website
date: Date

getPageViewsByHour (website_id, date)

Returns the number of page views grouped by hour for a specific date. Only recent dates may be available.
website_id: ID of the website
date: Date