- retrieve - Retrieve analytics for a link, a domain, or the authenticated workspace.
Retrieve analytics for a link, a domain, or the authenticated workspace. The response type depends on the event and type query parameters.
from dub import Dub
from dub.models import operations
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.analytics.retrieve(request={
"event": operations.Event.LEADS,
"domain": "dub.co",
"timezone": "America/New_York",
"city": "New York",
"device": "Desktop",
"browser": "Chrome",
"os": "Windows",
"referer": "google.com",
"referer_url": "https://dub.co/blog",
"query": "metadata['key']:'value'",
})
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.RetrieveAnalyticsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
operations.RetrieveAnalyticsResponseBody
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequest | 400 | application/json |
| errors.Unauthorized | 401 | application/json |
| errors.Forbidden | 403 | application/json |
| errors.NotFound | 404 | application/json |
| errors.Conflict | 409 | application/json |
| errors.InviteExpired | 410 | application/json |
| errors.UnprocessableEntity | 422 | application/json |
| errors.RateLimitExceeded | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.SDKError | 4XX, 5XX | */* |