Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Get Automation Click Tracking Stats by ID



API Overview

api-overview page anchor

As a Marketing Campaigns customer, you have access to rich statistics about your Single Sends and Automations. The Marketing Campaigns Statistics API allows you to retrieve these statistics programmatically. for detailed information about the statistics available, see the Marketing Campaigns Stats Overview.

(information)

Note

These endpoints provide stats for Marketing Campaigns only. For stats related to event tracking, please see the Stats API.


GET/v3/marketing/stats/automations/{id}/links

Base url: https://api.sendgrid.com

This endpoint lets you retrieve click-tracking stats for a single Automation.

The stats returned list the URLs embedded in your Automation and the number of clicks each one received.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
idstring<uuid>required

The ID of the Automation you want to get click tracking stats for.

Property nameTypeRequiredDescription
group_byarray[enum<string>]Optional

Automations can have multiple steps. Including step_id as a group_by metric allows further granularity of stats.

Possible values:
step_id

step_idsarray[string<uuid>]Optional

Comma-separated list of step_ids that you want the link stats for.


page_sizeintegerOptional

The number of elements you want returned on each page.

Minimum: 1Maximum: 50Default: 25

page_tokenstringOptional

The stats endpoints are paginated. To get the next page, call the passed _metadata.next URL. If _metadata.prev doesn't exist, you're at the first page. Similarly, if _metadata.next is not present, you're at the last page.

200400404
Schema
Property nameTypeRequiredDescriptionChild properties
resultsarray[object]

total_clicksinteger

_metadataobject

Get Automation Click Tracking Stats by ID

get-automation-click-tracking-stats-by-id page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_22
const client = require('@sendgrid/client');
_22
client.setApiKey(process.env.SENDGRID_API_KEY);
_22
_22
const id = "f15982c1-a82c-4e87-a6b2-a4a63b4b7644";
_22
const queryParams = {
_22
"page_size": 25
_22
};
_22
_22
const request = {
_22
url: `/v3/marketing/stats/automations/${id}/links`,
_22
method: 'GET',
_22
qs: queryParams
_22
}
_22
_22
client.request(request)
_22
.then(([response, body]) => {
_22
console.log(response.statusCode);
_22
console.log(response.body);
_22
})
_22
.catch(error => {
_22
console.error(error);
_22
});


Rate this page: