shortUrlAnalytics
Requires at least one of the permissions marketing:link:read, marketing:link:write or settings:integration:read.
Returns click statistics for one short link: total and unique clicks, and clicks by date, country, device and browser. Fails if the link does not exist. Needs the marketing links read or write permission, or the integration settings read permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query ShortUrlAnalytics($idOrCode: String!) {
shortUrlAnalytics(idOrCode: $idOrCode) {
totalClicks
uniqueClicks
clicksByBrowser {
browser
count
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ShortUrlAnalytics($idOrCode: String!) {\n shortUrlAnalytics(idOrCode: $idOrCode) {\n totalClicks\n uniqueClicks\n clicksByBrowser {\n browser\n count\n }\n }\n}",
"variables": {
"idOrCode": "string"
}
}
EOF
Variables:
{
"idOrCode": "string"
}
Response:
{
"data": {
"shortUrlAnalytics": {
"totalClicks": 0,
"uniqueClicks": 0,
"clicksByBrowser": [
{
"browser": "string",
"count": 0
}
]
}
}
}
shortUrlAnalytics(
idOrCode: String!
): ShortUrlAnalytics!
Arguments
shortUrlAnalytics.idOrCode ● String! non-null scalar
The ID, the short code or the custom alias of the short link.
Type
ShortUrlAnalytics object
How a short link was used.