collection.getStats

Returns the statistics for the specified collection.

Note: Requests must be made to https://api.flipsnack.com/v1.

Request parameters

Name

Type

Description

apiKey (required)

string

The API key provided for your user. If it is not specified, the request will return the error code "30 - Missing mandatory parameter". If the key is incorrect the request returns the error code "41 - Invalid credentials".

signature (required)

string

The signature must be calculated by you and added to the request. See How to sign a request for more information. If the parameter is missing the request will return the error code "30 - Missing mandatory parameter". If the signature is incorrect the request will return the error code "44 - Invalid signature".

action (required)

string

The API method that should be called. In this case the value should be collection.getStats. If it is not specified, the request will return the error code "30 - Missing mandatory parameter".

collectionHash (required)

string

The hash of the collection for which you want to get statistics. If you do not specify a collection hash, then the request will return the error code "30 - Missing mandatory parameter".

startDate

string

The start date for statistics interval. Date format must be: YYYY-MM-DD

endDate

string

The end date for statistics interval. Date format must be: YYYY-MM-DD

includePageStats

boolean

If set to true an array with statistics for each page will be returned.

Default: false.

Response parameters

Name

Type

Description

impressions

number

The number of impressions of the collection. Impressions are counted each time the player is loaded.

views

number

The number of views of the collection. Views are counted each time a user interacts with the player.

time_spent

number

The total time spent is measured in seconds and shows how much time people spend viewing the collection.

likes (DEPRECATED)

number

The number of likes your flipbook has received on Flipsnack.

downloads

number

The number of times your documents were downloaded from the collection.

pages

array

This array will be returned only if the includePageStats is set to true and the request format is json. This will be an array/list of properties containing: page (page index), time_spent (in seconds), clicks, views for each page.

Error codes

For complete list of error codes and messages go to API status codes section.

Examples

Request

# GET   
curl -X GET \
     -G \
     https://api.flipsnack.com/v1/ \
     -d action=collection.getStats \
     -d apiKey=<YOUR-API-KEY> \
     -d collectionHash=d3m0h45h \
     -d signature=<YOUR-REQUEST-SIGNATURE>
     

Response

{
    "code": 20,
    "status": "OK",
    "data": {
        "impressions": 723,
        "views": 1240,
        "time_spent": 53,
        "downloads": 4,
        "pages": [
            {
                "page": 1,
                "time_spent": 127443,
                "clicks": 392,
                "views": 4529
            },
            {
                "page": 2,
                "time_spent": 89382,
                "clicks": 171,
                "views": 4130
            }
        ]
    }
}

Last updated