(Analytics)
- 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.
package main
import(
dubgo "github.com/dubinc/dub-go"
"context"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
ctx := context.Background()
res, err := s.Analytics.Retrieve(ctx, operations.RetrieveAnalyticsRequest{
Timezone: dubgo.String("America/New_York"),
City: dubgo.String("New York"),
Device: dubgo.String("Desktop"),
Browser: dubgo.String("Chrome"),
Os: dubgo.String("Windows"),
Referer: dubgo.String("google.com"),
RefererURL: dubgo.String("https://dub.co/blog"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.RetrieveAnalyticsRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.RetrieveAnalyticsResponseBody, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.Unauthorized | 401 | application/json |
sdkerrors.Forbidden | 403 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.Conflict | 409 | application/json |
sdkerrors.InviteExpired | 410 | application/json |
sdkerrors.UnprocessableEntity | 422 | application/json |
sdkerrors.RateLimitExceeded | 429 | application/json |
sdkerrors.InternalServerError | 500 | application/json |
sdkerrors.SDKError | 4XX, 5XX | */* |