Flipsnack API
  • API documentation
  • Getting started
  • API status codes
  • API limitations
  • How to get an API key
  • How to sign a request
  • API reference
    • collection.create
    • collection.getCollection
    • collection.update
    • collection.deleteCollection
    • collection.getEmbed
    • collection.getStats
    • collection.getList
    • collection.downloadHTML
    • user.getStats
  • Zapier
    • zapier.getZapierLeadFormSample
Powered by GitBook
On this page
  • Request parameters
  • Response parameters
  • Error codes
  • Examples
  • Request
  • Response
  1. API reference

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

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>
     
<form method="get" action="https://api.flipsnack.com/v1/">
    <input type="hidden" name="action" value="collection.getStats">
    <input type="hidden" name="apiKey" value="<YOUR-API-KEY>">
    <input type="hidden" name="collectionHash">
    <input type="hidden" name="signature" value="<YOUR-REQUEST-SIGNATURE>">
    <button type="submit">Submit</button>
</form>

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
            }
        ]
    }
}
Previouscollection.getEmbedNextcollection.getList

Last updated 1 year ago

The signature must be calculated by you and added to the request. See 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".

How to sign a request