Subscribe to our social networks

map

API Documentation

Find here all the informations about Publytics API

Introduction

This documentation provides an overview of the available endpoints in the API. The API requires authentication through Sanctum and allows to access the API of a specific site only if the site has an active subscription.

Authentication

The API uses Bearer Token authentication. To authenticate you need to generate an API token for your user. This can be done by clicking on your user icon in the top right corner and selecting "API". You can then generate a new token by clicking on the "Create" button. The token will be displayed in the table. You can then use this token to authenticate with the API by adding it to the Authorization header of your request. Remember to save the token somewhere safe, as it will not be displayed again.

All requests can be done to a single site, substituting in the path its unique tracking {siteId}: you can find it in the "Tracking Options" page (e.g.: publytics.net/Px7reG).

Example API call

curl --location 'https://publytics.net/api/site/{siteId}/visitors/hostname' \
--header 'Authorization: Bearer {token}'

Endpoint List

GET /site/{siteId}/content

Retrieves the content of a site.

Query parameters

Parameter Description Default Value
start The start date for data filtering. If not specified, the current date minus 7 days is used. Current date - 7 days
end The end date for data filtering. If not specified, the current date minus 1 day is used. Current date - 1 day
primaryProp The primary property to use for grouping the data. If not specified, the default property "pathname" is used. "pathname"
customCols A JSON array containing custom columns to include in the data. If not specified, an empty array is used. Empty array
primaryPropFilter A JSON array containing filters to apply to the primary property. If not specified, an empty array is used. Empty array
customFilters A JSON array containing custom filters to apply to the data. If not specified, an empty array is used. Empty array
customPropFilter A JSON array containing custom filters to apply to the properties. If not specified, an empty array is used. Empty array
offset The offset for data pagination. If not specified, 1 is used. 1
sort The field to sort the data on. If not specified, the default column "views" is used. "views"
sortOrder The sorting order of the data. If not specified, "desc" (descending) is used. "desc"
compareStart The start date for data comparison. If not specified, null is used. null
compareEnd The end date for data comparison. If not specified, null is used. null
limit The limit of results to return. If not specified, 20 is used. The maximum allowed limit is 1000. 20
s

GET /site/{siteId}/acquisition/entry & GET /site/{siteId}/acquisition/exit

Retrieves the entry/exit pages of a site.

Query parameters

Parameter Description Default Value
start The start date for data filtering. If not specified, the current date minus 7 days is used. Current date - 7 days
end The end date for data filtering. If not specified, the current date minus 1 day is used. Current date - 1 day
customCols A JSON array containing custom columns to include in the data. If not specified, an empty array is used. Empty array
primaryPropFilter A JSON array containing filters to apply to the primary property. If not specified, an empty array is used. Empty array
customFilters A JSON array containing custom filters to apply to the data. If not specified, an empty array is used. Empty array
customPropFilter A JSON array containing custom filters to apply to the properties. If not specified, an empty array is used. Empty array
offset The offset for data pagination. If not specified, 1 is used. 1
sort The field to sort the data on. If not specified, the default column "views" is used. "views"
sortOrder The sorting order of the data. If not specified, "desc" (descending) is used. "desc"
compareStart The start date for data comparison. If not specified, null is used. null
compareEnd The end date for data comparison. If not specified, null is used. null
limit The limit of results to return. If not specified, 20 is used. The maximum allowed limit is 1000. 20

GET /site/{siteId}/acquisition/{prop}

Retrieves the acquisitions of a site for a specific property.

Query parameters

Parameter Description Default Value
start The start date for data filtering. If not specified, the current date minus 7 days is used. Current date - 7 days
end The end date for data filtering. If not specified, the current date minus 1 day is used. Current date - 1 day
customCols A JSON array containing custom columns to include in the data. If not specified, an empty array is used. Empty array
primaryPropFilter A JSON array containing filters to apply to the primary property. If not specified, an empty array is used. Empty array
customFilters A JSON array containing custom filters to apply to the data. If not specified, an empty array is used. Empty array
customPropFilter A JSON array containing custom filters to apply to the properties. If not specified, an empty array is used. Empty array
offset The offset for data pagination. If not specified, 1 is used. 1
sort The field to sort the data on. If not specified, the default column "views" is used. "views"
sortOrder The sorting order of the data. If not specified, "desc" (descending) is used. "desc"
compareStart The start date for data comparison. If not specified, null is used. null
compareEnd The end date for data comparison. If not specified, null is used. null
limit The limit of results to return. If not specified, 20 is used. The maximum allowed limit is 1000. 20

Parameter Description

prop (required) The property for which to retrieve the acquisitions.

The following properties are supported:

  • UTM campaigns: "utm_campaign"
  • UTM content: "utm_content"
  • UTM medium: "utm_medium"
  • UTM source: "utm_source"
  • UTM term: "utm_term"
  • Referrer: "referrer"
  • Referrer Source: "referrer_source"

GET /site/{siteId}/visitors

Retrieves users, sessions, page views, bounce rate.

Query parameters

Parameter Description Default Value
start The start date for data filtering. If not specified, the current date minus 7 days is used. Current date - 7 days
end The end date for data filtering. If not specified, the current date minus 1 day is used. Current date - 1 day

GET /site/{siteId}/visitors/{prop}

Retrieves the stats of a site for a specific property.

Query parameters

Parameter Description Default Value
start The start date for data filtering. If not specified, the current date minus 7 days is used. Current date - 7 days
end The end date for data filtering. If not specified, the current date minus 1 day is used. Current date - 1 day
customCols A JSON array containing custom columns to include in the data. If not specified, an empty array is used. Empty array
primaryPropFilter A JSON array containing filters to apply to the primary property. If not specified, an empty array is used. Empty array
customFilters A JSON array containing custom filters to apply to the data. If not specified, an empty array is used. Empty array
customPropFilter A JSON array containing custom filters to apply to the properties. If not specified, an empty array is used. Empty array
offset The offset for data pagination. If not specified, 1 is used. 1
sort The field to sort the data on. If not specified, the default column "views" is used. "views"
sortOrder The sorting order of the data. If not specified, "desc" (descending) is used. "desc"
compareStart The start date for data comparison. If not specified, null is used. null
compareEnd The end date for data comparison. If not specified, null is used. null
limit The limit of results to return. If not specified, 20 is used. The maximum allowed limit is 1000. 20

Parameter Description

prop (required) The property for which to retrieve the acquisitions.

The following properties are supported:

  • Device: "device"
  • Country: "country"
  • Operating system: "operating_system"
  • Browser: "browser"
  • Hostname: "hostname"

GET /site/{siteId}/events

Retrieves the events of a site.

Query parameters

Parameter Description Default Value
start The start date for data filtering. If not specified, the current date minus 7 days is used. Current date - 7 days
end The end date for data filtering. If not specified, the current date minus 1 day is used. Current date - 1 day
primaryProp The primary property to use for grouping the data. If not specified, the default property "pathname" is used. "pathname"
customCols A JSON array containing custom columns to include in the data. If not specified, an empty array is used. Empty array
primaryPropFilter A JSON array containing filters to apply to the primary property. If not specified, an empty array is used. Empty array
customFilters A JSON array containing custom filters to apply to the data. If not specified, an empty array is used. Empty array
customPropFilter A JSON array containing custom filters to apply to the properties. If not specified, an empty array is used. Empty array
offset The offset for data pagination. If not specified, 1 is used. 1
sort The field to sort the data on. If not specified, the default column "views" is used. "views"
sortOrder The sorting order of the data. If not specified, "desc" (descending) is used. "desc"
compareStart The start date for data comparison. If not specified, null is used. null
compareEnd The end date for data comparison. If not specified, null is used. null
limit The limit of results to return. If not specified, 20 is used. The maximum allowed limit is 1000. 20