Statcounter API Documentation - Version 3

  • 1. Introduction #

    The Statcounter API accepts requests via the HTTP GET method. Results are returned in either JSON (default) or XML format. To perform the required task, simply send the necessary HTTP request, as described in this specification.

    All API calls return an error response in the case of a failure. The structure of an error response (JSON format) is as follows:

    { "@attributes": { "status": "fail", }, "error": [{ "code": "CODE", "description": "ERROR_DESCRIPTION" }] }
  • 2. API Login Credentials #

    To use the Statcounter API, you will require a Statcounter account with a paid upgrade. If you do not already have an account, you must sign up for an account. Paid upgrades are available here.

    Once you have a Statcounter account with a paid upgrade, you will need to set your API password. You may then construct an API call.

    If you do not have an upgraded account, you may test the Statcounter API using our Demo API User details:

    Username: demo_user
    API Password: statcounter
    Demo Project ID: 2292634

  • 3. Constructing an API Call #

    Each Statcounter API call contains settings that configure the task or function that you wish to execute. To perform the required task, you must configure the correct settings.

    As an example, we will look in detail at how to retrieve statistics for Recent Visitors.

    All API calls are sent via HTTP to the same URL, so every API call must begin with:

    http://api.statcounter.com/

    The correct function must then be added to the call (e.g. stats/, add_project/, update_project/, etc.). In this example, we will add "stats/", as stated in the specification for Recent Visitors:

    http://api.statcounter.com/stats/

    The next step is to add the required settings, beginning with the "?" symbol, with each setting separated by the "&" symbol.

    The "Version Number" (vn) setting determines the particular API version number that you wish to use. The current API version is version 3. To request the most recent API version number, we use "vn=3":

    http://api.statcounter.com/stats/?vn=3

    Again, using Recent Visitors as an example, we will look at the "Stats" (s) setting. "Stats" determines the set of statistics which you wish to return e.g. summary, visitor, popular. To request the "Recent Visitor Activity" statistics, we use "s=visitor":

    http://api.statcounter.com/stats/?vn=3&s=visitor

    The "Format" (f) setting determines the format in which you wish to return data from the server. The available options are "JSON" and "XML". The default setting is "JSON". To request "XML" format, use "f=xml":

    http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml

    The "Project ID" (pi) is always required when retrieving data for a particular project. To request project ID "1234567", for example, use "pi=1234567":

    http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml&pi=1234567

    You can also set the number of results (n) that you wish to return. This setting is optional, and will return 20 results by default if not set. To request 10 returned results, use "n=10":

    http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml&pi=1234567&n=10

    For security and authentication reasons, each API call must be accompanied by the time of execution (t) of the call, in Unix timestamp format. When a scripting language such as PHP, the timestamp can easily be generated with the "time()" function e.g. timestamp "1329142078". To include this timestamp in your API call, we use "t=1329142078":

    http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml&pi=1234567&n=10&t=1329142078

    You must also include your Statcounter username in the API call e.g. username "myusername". To include your username in the API call, we use "u=myusername":

    http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml&pi=1234567&n=10&t=1329142078&u=myusername

    The final step in creating your API call for Recent Visitors is to add the SHA-1 (sha1) authentication data. The SHA-1 proves your identity within the Statcounter system. The SHA-1 value that you must use is found by calculating the SHA-1 value of the existing URL query string to-date, with your API password appended.

    In our example, the URL query string to-date is:

    ?vn=3&s=visitor&f=xml&pi=1234567&n=10&t=1329142078&u=myusername

    If we take our example password to be "mypassword", and append it to the URL query string, we get the following string:

    ?vn=3&s=visitor&f=xml&pi=1234567&n=10&t=1329142078&u=myusernamemypassword

    Using PHP, the SHA-1 of this string can easily be found using the sha1() function:

    sha1("?vn=3&s=visitor&f=xml&pi=1234567&n=10&t=1329142078&u=myusernamemypassword");

    The following SHA-1 string is returned:

    e0fd149f1999f81ce474070a01c7b14c01e4044f

    The final step in creating our API call is to go back to our URL string to-date, and add the SHA-1 value:

    http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml&pi=1234567&n=10&t=1329142078&u=myusername&sha1=e0fd149f1999f81ce474070a01c7b14c01e4044f

    When this URL is passed to the Statcounter server via HTTP, the data will be returned, in this case, in XML format. The URL will only work for 15 minutes, after which time, it will need to be re-constructed.

  • 4. Retrieve Stats #

    • 4.2 Multiple Project Selection #

    • The Statcounter API allows for the retrieval of stats data for multiple projects in one call. This may be faster than making a seperate call to the stats function for each project of interest. To request data for multiple projects, just add multiple "Project ID" (pi) parameters to your stats call:

      http://api.statcounter.com/stats/?vn=3&s=visitor&f=xml&pi=123&pi=456pi=789

      The returned response structure is different when multiple "Project ID" (pi) parameters are used. The response will consist of an array of objects composed of a id attribute, representing the Project ID, and the normal sc_data attribute with the associated project's stats data:

      { "@attributes": { "status": "ok", }, "project": [{ "id": "123", "sc_data": [{ ... }, { "id": "456", "sc_data": [{ ... }, { "id": "789", "sc_data": [{ ... }] }] }
    • 4.3 Summary Stats #

      • 4.3.1 Summary Stats - Hourly #

        Successful response structure (JSON format):

        { "@attributes": { "status": "ok", }, "sc_data": [{ "date": "DATE", (YYYY-MM-DD) "hour": "HOUR", (HH) "page_views": "PAGE_VIEWS", "unique_visits": "UNIQUE_VISITS", "returning_visits": "RETURNING_VISITS", "first_time_visits": "FIRST_TIME_VISITS" }] }

        Here is a sample return containing data from a number of days:

        { "@attributes":{ "status":"ok" }, "sc_data": [{ "date":"2012-01-10", "hour":"01", "page_views":"3369", "unique_visits":"938", "returning_visits":"289" }, { "date":"2012-01-11", "hour":"02", "page_views":"2409", "unique_visits":"840", "returning_visits":"258" }, { "date":"2012-01-12", "hour":"03", "page_views":"2712", "unique_visits":"1068", "returning_visits":"277" }] }
      • 4.3.2 Summary Stats - Daily #

        Optional: New methodology session & visitor summary data

        Successful response structure (JSON format):

        { "@attributes": { "status": "ok", }, "sc_data": [{ "date": "DATE", (YYYY-MM-DD) "page_views": "PAGE_VIEWS", "unique_visits": "UNIQUE_VISITS", "returning_visits": "RETURNING_VISITS", "first_time_visits": "FIRST_TIME_VISITS" }] }

        Here is a sample return containing data from a number of days:

        { "@attributes":{ "status":"ok" }, "sc_data": [{ "date":"2012-01-10", "page_views":"3369", "unique_visits":"938", "returning_visits":"289" }, { "date":"2012-01-11", "page_views":"2409", "unique_visits":"840", "returning_visits":"258" }, { "date":"2012-01-12", "page_views":"2712", "unique_visits":"1068", "returning_visits":"277" }] }
      • 4.3.3 Summary Stats - Weekly #

        http://api.statcounter.com/stats/?vn=VERSION_NUMBER&s=summary&g=GRANULARITY&sy=START_YEAR&sw=START_WEEK&ey=END_YEAR&ew=END_WEEK&pi=PROJECT_ID&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

        Optional: New methodology session & visitor summary data

        Successful response structure (JSON format):

        { "@attributes": { "status": "ok", }, "sc_data": [{ "year": "YEAR", "week": "WEEK", "page_views": "PAGE_VIEWS", "unique_visits": "UNIQUE_VISITS", "returning_visits": "RETURNING_VISITS", "first_time_visits": "FIRST_TIME_VISITS" }] }

        Here is a sample return containing data from a number of days:

        { "@attributes":{ "status":"ok" }, "sc_data": [{ "year":"2012", "week":"1", "page_views":"3369", "unique_visits":"938", "returning_visits":"289" }, { "year":"2012", "week":"2", "page_views":"2409", "unique_visits":"840", "returning_visits":"258" }] }
      • 4.3.4 Summary Stats - Monthly #

        http://api.statcounter.com/stats/?vn=VERSION_NUMBER&s=summary&g=GRANULARITY&sm=START_MONTH&sy=START_YEAR&em=END_MONTH&ey=END_YEAR&pi=PROJECT_ID&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

        Optional: New methodology session & visitor summary data

        Successful response structure (JSON format):

        { "@attributes": { "status": "ok", }, "sc_data": [{ "year": "YEAR", "month": "MONTH", (MM) "page_views": "PAGE_VIEWS", "unique_visits": "UNIQUE_VISITS", "returning_visits": "RETURNING_VISITS", "first_time_visits": "FIRST_TIME_VISITS" }] }

        Here is a sample return containing data from a number of days:

        { "@attributes":{ "status":"ok" }, "sc_data": [{ "year":"2012", "month":"1", "page_views":"3369", "unique_visits":"938", "returning_visits":"289" }, { "year":"2012", "month":"2", "page_views":"2409", "unique_visits":"840", "returning_visits":"258" }, { "year":"2012", "month":"3", "page_views":"2712", "unique_visits":"1068", "returning_visits":"277" }] }
      • 4.3.5 Summary Stats - Quarterly #

        Optional: New methodology session & visitor summary data

        Successful response structure (JSON format):

        { "@attributes": { "status": "ok", }, "sc_data": [{ "year": "YEAR", "quarter": "QUARTER", "page_views": "PAGE_VIEWS", "unique_visits": "UNIQUE_VISITS", "returning_visits": "RETURNING_VISITS", "first_time_visits": "FIRST_TIME_VISITS" }] }

        Here is a sample return containing data from a number of days:

        { "@attributes":{ "status":"ok" }, "sc_data": [{ "year":"2012", "quarter": "1", "page_views":"3369", "unique_visits":"938", "returning_visits":"289" }, { "year":"2012", "quarter": "2", "unique_visits":"840", "returning_visits":"258" }] }
  • Query String Fields

    Each API call is made with a URL containing a detailed query string. The fields used by the API are detailed below.

    vn – Version Number
    The version number of the Statcounter API that you are calling. This document describes the Statcounter API for Version 3 so the value '3' should always be passed.
    Example: vn=3

    f – Format
    The required format of the returned data. The available options are 'json' and 'xml'. JSON is the default format.
    Example: f=xml

    s – Stats
    The stats that you wish to call. The available options are:
    - summary (Summary Stats)
    - visitor (Recent Visitor Activity)
    - popular (Popular Pages)
    - entry (Entry Pages)
    - exit (Exit Pages)
    - camefrom (Recent Came From)
    Example: s=popular

    pi – Project ID
    The project ID of your Statcounter project.
    Example: pi=7407742

    u – Username
    Your statCounter username.
    Example: u=myusername

    wt – Website Title
    The name that will be given to the new Statcounter project e.g. 'My Website'. The title must be encoded for use in the URL.
    Example: wt=My%20Website

    wu – Website URL
    The URL of the website e.g. 'http://www.mywebsite.com/'. The URL must be encoded for use in the URL.
    Example: wu=http%3A%2F%2Fwww.mywebsite.com

    ls – Log Size
    The desired log size for the project.
    Example: ls=5000

    t – Time of Execution
    The time of execution of the request, in Unix timestamp format.
    Example: t=1321438882

    tz – Time Zone
    The time zone to be used for the project stats e.g. 'America/New_York'. See Time Zone Options in the Appendix for the complete list. The default is America/New_York. The Time Zone must be encoded for use in the URL.
    Example: tz=America%2FNew_York

    ps – Public Stats
    Set the level of public access to stats in a project. The default is that all stats are publicly available. The available options are:
    0: All public stats are disabled 1: All stats are public 2: Only 'Summary Stats' are public Example: ps=2

    n – Number of Results
    The number of results to return.
    Example: n=10

    c – Chop URL
    Chop the query string from the returned URL. Many URLs contain data variables in a query string that is used to set details on the web page. Chopping the query string can make the returned URL list easier to read and less cluttered. The available options are '0' and '1'. The default is '1' (chop URL).
    Example: c=1

    ct – Count Type
    The type of counts used by a stat. A stat can be counted by page views or visitors. The available api options are 'page_view' and 'visitor'. The default is 'page_view'.
    Example: ct=page_view

    g – Granularity
    The time interval of returned stats, used with a 'Summary Stats' query. Default value is 'weekly'. The available options are:
    - hourly
    - daily
    - weekly
    - monthly
    - quarterly
    - yearly
    Example: g=weekly

    sh – Start Hour
    The start hour for a time period in a 'Summary Stats' query. Default value is '0'.
    Example: sh=10

    sd – Start Day
    The start day for a time period in a 'Summary Stats' query. Default value is '1'.
    Example: sd=26

    sm – Start Month
    The start month for a time period in a 'Summary Stats' query. Default value is '1'.
    Example: sm=8

    sy – Start Year
    The start year for a time period in a 'Summary Stats' query. Default value is '2024'.
    Example: sy=2011

    sw – Start Week
    The start week for a time period in a 'Summary Stats' query. Only required if granularity is 'weekly'. Default value is '1'.
    Example: sw=2

    sq – Start Quarter
    The start quarter for a time period in a 'Summary Stats' query. Only required if granularity is 'quarterly'. Default value is '1'.
    Example: sq=1

    eh – End Hour
    The end hour for a time period in a 'Summary Stats' query. Default value is '23'.
    Example: eh=22

    ed – End Day
    The end day for a time period in a 'Summary Stats' query. Default value is '28'.
    Example: ed=30

    em – End Month
    The end month for a time period in a 'Summary Stats' query. Default value is '12'.
    Example: em=11

    ey – End Year
    The end year for a time period in a 'Summary Stats' query. Default value is '2024'.
    Example: ey=2012

    ew – End Week
    The end week for a time period in a 'Summary Stats' query. Only required if granularity is 'weekly'. Default value is '2'.
    Example: ew=34

    eq – End Quarter
    The end quarter for a time period in a 'Summary Stats' query. Only required if granularity is 'quarterly'. Default value is '4'.
    Example: eq=4

    e – Exclude External
    Choose to exclude external results to your site. Available options are '0' or '1'. Default value is '1' (exclude external).
    Example: e=1

    ese – Exclude Search Engines
    Choose to exclude search engine driven results to your site. Available options are '0' or '1'. Default value is '0' (include search engines).
    Example: ese=1

    eek – Exclude Encrypted Keywords
    Choose to exclude encrypted keyword results. Available options are '0' or '1'. Default value is '0' (include encrypted keyword results).
    Example: eek=1

    ck – Combine Keywords
    Choose to combine keyword results based on one of three possible criteria. Available options are 'search_engine_host' or 'search_engine_name' or 'together'. Default value is 'search_engine_host'.
    Example: ck=together

    gbd – Group By Domain
    Choose to group results by referring domain, in the 'Came From' stats query. Available options are '0' or '1'. Default value is '0' (do not group by domain).
    Example: gbd=1

    de – Device
    Choose the device type. Default value is 'All'. The available options are:
    - all
    - desktop
    - mobile
    Example: de=mobile

    ip – I.P. Address
    The I.P. address of a visitor you want to look up, in the stat lookup_visitor.
    Example: ip=192.168.1.1

    Only available when adding a new project or updating a pre-existing one:

    gid – Project Group ID
    The Group ID reference where you want assign project.
    Example: gid=12

    gn – Project Group Name
    The Group name where you want assign project.
    Example: gn=social-projects

    fcg – Force to create Project Group
    In case you want to assign a project to a nonexistent group: you can combine `fcg=1` with the parameter `&gn=[PROJECT_GROUP_NAME]` and create the group then the api call will assign it to the project in the api call
    Example: &fcg=1&gn=social-projects
    NOTE: This parameter is available when you are creating or updating a project only. Will be ignored if parameter `&gid` is present on the api call.

    sha1 – SHA-1 Proof
    The SHA-1 proof is used to verify your identity within the Statcounter system. It is created from the SHA-1 value of the existing URL query string to-date, with your API password appended. e.g. sha1 (query string + api password)

    • Query string is the full URL query string, beginning with and including '?'.
    • The API password is set by you (see API Login Credentials for more details).
    Example: sha1=e0fd149f1999f81ce474070a01c7b14c01e4044f

  • 5. Create a New Project #

    Successful response structure (JSON format):

    { "@attributes": { "status": "ok", }, "sc_data": [{ "project_id": "PROJECT_ID", "security_code": "SECURITY_CODE" }] }

    Once you receive a successful response, it is important to save the PROJECT_ID and the SECURITY_CODE into a database for that website, as these values will need to be retrieved each time the website is loaded.

    Additional documentation: Creating a new project within a group

  • 6. Update Project Settings #

    http://api.statcounter.com/update_project/?vn=VERSION_NUMBER&pi=PROJECT_ID&t=TIME_OF_EXECUTION&u=USERNAME&ps=PUBLIC_STATS&f=FORMAT&u=USERNAME&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status": "ok" } }

    Additional documentation: Assigning an existing project to a group

  • 7. Increase Project Log Size #

    This call allows you to increase the log size of any of your projects. The log size must be greater than 500, and you cannot use this call to decrease the log size.

    http://api.statcounter.com/update_logsize/?vn=VERSION_NUMBER&pi=PROJECT_ID&ls=LOG_SIZE&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "message": "The adjust log request has been received for project ID PROJECT_ID and will be processed in the next 5 minutes" } }
  • 8. Retrieve Account Log Sizes #

    This call will return log details for each project associated with your account.

    http://api.statcounter.com/account_logsizes/?vn=VERSION_NUMBER&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" }, "sc_data": { "project_id":"PROJECT_ID", "project_name":"PROJECT_NAME", "log_size":"LOG_SIZE", "log_usage":"LOG_USAGE", "log_size_days_estimated":"LOG_SIZE_DAYS_ESTIMATE", "log_size_days_usage":"LOG_SIZE_DAYS_USAGE" } }
  • 9. Retrieve User Details #

    This call will return details of the user making the call.

    http://api.statcounter.com/user_details/?vn=VERSION_NUMBER&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" }, "sc_data":[{ "name":"FULL_NAME", "email":"EMAIL_ADDRESS", "log_quota":"LOG_QUOTA", "upgraded":"UPGRADED", "date_format":"DATE_FORMAT", "time_format":"TIME_FORMAT", "timezone":"TIMEZONE" }] }

    Note:

    date_format key:

    1. DD MONTH YYYY
    2. MONTH DD YYYY
    3. YYYY.MM.DD
    4. DDth MONTH YYYY
    5. MONTH DDth YYYY

    time_format key:

    1. HH:MM:SS
    2. HH:MM:SS AM/PM
    3. HH:MM:SS
    4. HH:MM:SS AM/PM
  • 10. Integrate Statcounter Stats using an iframe #

    To view the public website stats, the user needs to be sent to the following website URL:

    http://statcounter.com/pPROJECT_ID?guest=1

    project_id
    The project ID returned by Statcounter via the API.
    Example: 3104569

    The user can view their website stats inside any control panel with the following iframe integration:

    <HTML> <HEAD> <TITLE>User Admin Panel</TITLE> </HEAD> <BODY> <p>Your Standard Control Panel HTML here</p> <iframe src = "http://statcounter.com/pPROJECT_ID?guest=1" width="100%" height="900"> <p>Your browser does not support iframes.</p> </iframe> </BODY> </HTML>
  • 11. Retrieve User Project Details #

    This call will return details of each project for which the given user has sufficient permissions.

    http://api.statcounter.com/user_projects/?vn=VERSION_NUMBER&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" }, "sc_data":[{ "project_id":"PROJECT_ID", "security_code":"SECURITY_CODE", "project_name":"PROJECT_NAME", "url":"URL", "sc_invisible":"SC_INVISIBLE", "project_group_id":"PROJECT_GROUP_ID", "project_group_name":"PROJECT_GROUP_NAME", "hidden_group":"HIDDEN_GROUP" }] }
  • 12. Select Project Details #

    This call will return details of a project specified by the project id (pi) parameter

    http://api.statcounter.com/select_project/?vn=VERSION_NUMBER&pi=PROJECT_ID&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" }, "sc_data":[{ "project_name":"PROJECT_NAME", "log_size": "LOG_SIZE", "timezone": "TIME_ZONE", "url":"URL", "log_oldest_entry":"LOG_OLDEST_ENTRY", "log_latest_entry":"LOG_LATEST_ENTRY", "created_at":"CREATED_AT" }] }
  • 13. Create IP Label #

    This call allows you to create an IP address label for any of your projects.

    http://api.statcounter.com/create_ip_label?vn=VERSION_NUMBER&pi=PROJECT_ID&ip=IP_ADDRESS&ipl=IP_LABEL&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" } }
  • 14. Get IP Labels #

    This call allows you to get all IP address labels for any of your projects.

    http://api.statcounter.com/get_ip_labels?vn=VERSION_NUMBER&pi=PROJECT_ID&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" }, "sc_data":[{ "ip_address":"IP_ADDRESS", "ip_address_label": "IP_ADDRESS_LABEL" }] }
  • 15. Delete IP Label #

    This call allows you to delete an IP address label for any of your projects.

    http://api.statcounter.com/delete_ip_label?vn=VERSION_NUMBER&pi=PROJECT_ID&ipl=IP_LABEL&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" } }
  • 16. Delete Project #

    This call allows you to delete a project.

    NOTE:
    a. this API call will require an admin user and the admin password
    b. this API call will delete all the users related to the project. If that the case an user it's related with other projects then won't be deleted.

    Successful response structure (JSON format):

    { "@attributes": { "status":"ok" } }
  • 17. Appendix: #

    • 17.1 Add a Project to a Group #

      This call is an example of adding a new project and assigning it to a Project Group in one call.

      The additional parameters that are relevant here are "gn" - the group name - or "gid" - the group id - and "fcg", which instructs the call to create the project group with the passed name if it doesn't already exist. "gid" is only used where you know the id of an existing group - in all other cases it is ignored. In the example below we are using the group name (gn) and force create group (fcg) parameters together, but if you knew the id of an existing group, you could pass that instead in the group id (gid) parameter.

      Successful response structure (JSON format):

      { "@attributes":{ "status":"ok" }, "sc_data":[{ "project_id":"PROJECT_ID", "security_code":"SECURITY_CODE", "project_group_id":"PROJECT_GROUP_ID" }] }

      In a similar fashion you can use the `update-project` API call to assign an existing project to a project group. Again, you pass "gn" (group name) or "gi" (group id) - and indicate if the project group should be created if it doesnt already exist, via the paramter "fcg" (force create group). In the example below we are using a known group ID to indicate the group we want to assign the project to.


      http://api.statcounter.com/update_project/?vn=VERSION_NUMBER&pi=PROJECT_ID&t=TIME_OF_EXECUTION&u=USERNAME&ps=PUBLIC_STATS&gid=GROUP_ID&f=FORMAT&u=USERNAME&sha1=SHA-1_TO_PROVE_IDENTITY

      Successful response structure (JSON format):

      { "@attributes":{ "status":"ok" }, "sc_data":[ { "project_id":"PROJECT_ID", "project_group_id":"PROJECT_GROUP_ID" } ] }
    • 17.2 Timezone parameter options:#


      • Africa/Abidjan
      • Africa/Accra
      • Africa/Addis_Ababa
      • Africa/Algiers
      • Africa/Asmera
      • Africa/Bamako
      • Africa/Bangui
      • Africa/Banjul
      • Africa/Bissau
      • Africa/Blantyre
      • Africa/Brazzaville
      • Africa/Bujumbura
      • Africa/Cairo
      • Africa/Casablanca
      • Africa/Ceuta
      • Africa/Conakry
      • Africa/Dakar
      • Africa/Dar_es_Salaam
      • Africa/Djibouti
      • Africa/Douala
      • Africa/El_Aaiun
      • Africa/Freetown
      • Africa/Gaborone
      • Africa/Johannesburg
      • Africa/Kampala
      • Africa/Khartoum
      • Africa/Kigali
      • Africa/Kinshasa
      • Africa/Lagos
      • Africa/Libreville
      • Africa/Lome
      • Africa/Luanda
      • Africa/Lubumbashi
      • Africa/Lusaka
      • Africa/Malabo
      • Africa/Maputo
      • Africa/Maseru
      • Africa/Mbabane
      • Africa/Mogadishu
      • Africa/Monrovia
      • Africa/Nairobi
      • Africa/Ndjamena
      • Africa/Niamey
      • Africa/Nouakchott
      • Africa/Ouagadougou
      • Africa/Porto-Novo
      • Africa/Sao_Tome
      • Africa/Timbuktu
      • Africa/Tripoli
      • Africa/Tunis
      • Africa/Windhoek
      • America/Adak
      • America/Anchorage
      • America/Anguilla
      • America/Antigua
      • America/Araguaina
      • America/Aruba
      • America/Asuncion
      • America/Barbados
      • America/Belem
      • America/Belize
      • America/Boa_Vista
      • America/Bogota
      • America/Boise
      • America/Buenos_Aires
      • America/Cambridge_Bay
      • America/Cancun
      • America/Caracas
      • America/Catamarca
      • America/Cayenne
      • America/Cayman
      • America/Chicago
      • America/Chihuahua
      • America/Cordoba
      • America/Costa_Rica
      • America/Cuiaba
      • America/Curacao
      • America/Dawson
      • America/Dawson_Creek
      • America/Denver
      • America/Detroit
      • America/Dominica
      • America/Edmonton
      • America/El_Salvador
      • America/Ensenada
      • America/Fortaleza
      • America/Glace_Bay
      • America/Godthab
      • America/Goose_Bay
      • America/Grand_Turk
      • America/Grenada
      • America/Guadeloupe
      • America/Guatemala
      • America/Guayaquil
      • America/Guyana
      • America/Halifax
      • America/Havana
      • America/Hermosillo
      • America/Indiana/Knox
      • America/Indiana/Marengo
      • America/Indiana/Vevay
      • America/Indianapolis
      • America/Inuvik
      • America/Iqaluit
      • America/Jamaica
      • America/Jujuy
      • America/Juneau
      • America/Kentucky/Monticello
      • America/La_Paz
      • America/Lima
      • America/Los_Angeles
      • America/Louisville
      • America/Maceio
      • America/Managua
      • America/Manaus
      • America/Martinique
      • America/Mazatlan
      • America/Mendoza
      • America/Menominee
      • America/Merida
      • America/Mexico_City
      • America/Miquelon
      • America/Monterrey
      • America/Montevideo
      • America/Montreal
      • America/Montserrat
      • America/Nassau
      • America/New_York
      • America/Nipigon
      • America/Nome
      • America/Noronha
      • America/Panama
      • America/Pangnirtung
      • America/Paramaribo
      • America/Phoenix
      • America/Port_of_Spain
      • America/Port-au-Prince
      • America/Porto_Acre
      • America/Porto_Velho
      • America/Puerto_Rico
      • America/Rainy_River
      • America/Rankin_Inlet
      • America/Regina
      • America/Rosario
      • America/Santiago
      • America/Santo_Domingo
      • America/Sao_Paulo
      • America/Scoresbysund
      • America/Shiprock
      • America/St_Johns
      • America/St_Kitts
      • America/St_Lucia
      • America/St_Thomas
      • America/St_Vincent
      • America/Swift_Current
      • America/Tegucigalpa
      • America/Thule
      • America/Thunder_Bay
      • America/Tijuana
      • America/Tortola
      • America/Vancouver
      • America/Whitehorse
      • America/Winnipeg
      • America/Yakutat
      • America/Yellowknife
      • Antarctica/South_Pole
      • Asia/Aden
      • Asia/Almaty
      • Asia/Amman
      • Asia/Anadyr
      • Asia/Aqtau
      • Asia/Aqtobe
      • Asia/Ashgabat
      • Asia/Ashkhabad
      • Asia/Baghdad
      • Asia/Bahrain
      • Asia/Baku
      • Asia/Bangkok
      • Asia/Beirut
      • Asia/Bishkek
      • Asia/Brunei
      • Asia/Calcutta
      • Asia/Chungking
      • Asia/Colombo
      • Asia/Dacca
      • Asia/Damascus
      • Asia/Dili
      • Asia/Dubai
      • Asia/Dushanbe
      • Asia/Gaza
      • Asia/Harbin
      • Asia/Hong_Kong
      • Asia/Hovd
      • Asia/Irkutsk
      • Asia/Jakarta
      • Asia/Jayapura
      • Asia/Jerusalem
      • Asia/Kabul
      • Asia/Kamchatka
      • Asia/Karachi
      • Asia/Kashgar
      • Asia/Katmandu
      • Asia/Krasnoyarsk
      • Asia/Kuala_Lumpur
      • Asia/Kuching
      • Asia/Kuwait
      • Asia/Macao
      • Asia/Magadan
      • Asia/Manila
      • Asia/Muscat
      • Asia/Nicosia
      • Asia/Novosibirsk
      • Asia/Omsk
      • Asia/Phnom_Penh
      • Asia/Pyongyang
      • Asia/Qatar
      • Asia/Rangoon
      • Asia/Riyadh
      • Asia/Saigon
      • Asia/Samarkand
      • Asia/Seoul
      • Asia/Shanghai
      • Asia/Singapore
      • Asia/Taipei
      • Asia/Tashkent
      • Asia/Tbilisi
      • Asia/Tehran
      • Asia/Thimbu
      • Asia/Thimphu
      • Asia/Tokyo
      • Asia/Ujung_Pandang
      • Asia/Ulaanbaatar
      • Asia/Ulan_Bator
      • Asia/Urumqi
      • Asia/Vientiane
      • Asia/Vladivostok
      • Asia/Yakutsk
      • Asia/Yekaterinburg
      • Asia/Yerevan
      • Atlantic/Azores
      • Atlantic/Bermuda
      • Atlantic/Canary
      • Atlantic/Canary
      • Atlantic/Cape_Verde
      • Atlantic/Faeroe
      • Atlantic/Jan_Mayen
      • Atlantic/Madeira
      • Atlantic/Reykjavik
      • Atlantic/South_Georgia
      • Atlantic/St_Helena
      • Atlantic/Stanley
      • Australia/Adelaide
      • Australia/Brisbane
      • Australia/Broken_Hill
      • Australia/Darwin
      • Australia/Hobart
      • Australia/Lindeman
      • Australia/Lord_Howe
      • Australia/Melbourne
      • Australia/Perth
      • Australia/Sydney
      • Canada/Atlantic
      • Canada/Central
      • Canada/Eastern
      • Canada/East-Saskatchewan
      • Canada/Mountain
      • Canada/Newfoundland
      • Canada/Pacific
      • Canada/Saskatchewan
      • Canada/Yukon
      • Europe/Amsterdam
      • Europe/Andorra
      • Europe/Athens
      • Europe/Belfast
      • Europe/Belgrade
      • Europe/Berlin
      • Europe/Bratislava
      • Europe/Brussels
      • Europe/Bucharest
      • Europe/Budapest
      • Europe/Chisinau
      • Europe/Copenhagen
      • Europe/Dublin
      • Europe/Gibraltar
      • Europe/Helsinki
      • Europe/Istanbul
      • Europe/Kaliningrad
      • Europe/Kiev
      • Europe/Lisbon
      • Europe/Ljubljana
      • Europe/London
      • Europe/Luxembourg
      • Europe/Madrid
      • Europe/Malta
      • Europe/Minsk
      • Europe/Monaco
      • Europe/Moscow
      • Europe/Oslo
      • Europe/Paris
      • Europe/Prague
      • Europe/Riga
      • Europe/Rome
      • Europe/Samara
      • Europe/San_Marino
      • Europe/Sarajevo
      • Europe/Simferopol
      • Europe/Skopje
      • Europe/Sofia
      • Europe/Stockholm
      • Europe/Tallinn
      • Europe/Tirane
      • Europe/Tiraspol
      • Europe/Uzhgorod
      • Europe/Vaduz
      • Europe/Vatican
      • Europe/Vienna
      • Europe/Vilnius
      • Europe/Warsaw
      • Europe/Zagreb
      • Europe/Zaporozhye
      • Europe/Zurich
      • Indian/Antananarivo
      • Indian/Chagos
      • Indian/Christmas
      • Indian/Cocos
      • Indian/Comoro
      • Indian/Kerguelen
      • Indian/Mahe
      • Indian/Maldives
      • Indian/Mauritius
      • Indian/Mayotte
      • Indian/Reunion
      • Pacific/Apia
      • Pacific/Auckland
      • Pacific/Chatham
      • Pacific/Easter
      • Pacific/Efate
      • Pacific/Enderbury
      • Pacific/Fakaofo
      • Pacific/Fiji
      • Pacific/Funafuti
      • Pacific/Galapagos
      • Pacific/Gambier
      • Pacific/Guadalcanal
      • Pacific/Guam
      • Pacific/Honolulu
      • Pacific/Johnston
      • Pacific/Kiritimati
      • Pacific/Kosrae
      • Pacific/Kwajalein
      • Pacific/Majuro
      • Pacific/Marquesas
      • Pacific/Midway
      • Pacific/Nauru
      • Pacific/Niue
      • Pacific/Norfolk
      • Pacific/Noumea
      • Pacific/Pago_Pago
      • Pacific/Palau
      • Pacific/Pitcairn
      • Pacific/Ponape
      • Pacific/Port_Moresby
      • Pacific/Rarotonga
      • Pacific/Saipan
      • Pacific/Tahiti
      • Pacific/Tarawa
      • Pacific/Tongatapu
      • Pacific/Truk
      • Pacific/Wake
      • Pacific/Wallis
      • Pacific/Yap
    • 17.3 New Methodology Session & Visitor Data

      Statcounter is rolling out a new session and visitor counting methodology. This rollout is still at an early stage and is currently only available for accounts created after August 4 2016. However, for projects where this data is available, the new data can be retrieved in summary stats API calls by adding an extra url parameter to your request: &method=new e.g.

      http://api.statcounter.com/stats/?vn=VERSION_NUMBER&s=summary&g=GRANULARITY&sd=START_DAY&sm=START_MONTH&sy=START_YEAR&ed=END_DAY&em=END_MONTH&ey=END_YEAR&pi=PROJECT_ID&method=new&t=TIME_OF_EXECUTION&u=USERNAME&f=FORMAT&sha1=SHA-1_TO_PROVE_IDENTITY

      When this parameter is passed, extra visitor and session data based on the new counting methodology will be returned in the API response, if the new counting methodology has been enabled for the project. The fields for this data are:

      { "sc_data": [{ ... "sessions": "SESSIONS", "returning_sessions": "RETURNING_SESSIONS", "visitors": "VISITORS", "new_visitors": "NEW_VISITORS" ... }] }

      These new fields will be returned in addition the standard fields already returned. If the project does not currently support the new counting methodology, the parameter is ignored and these extra fields will not be returned.

Last Update: 9th November 2017

webd002
24.967908859253