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.
These endpoints provide stats for Marketing Campaigns only. For stats related to event tracking, please see the Stats API.
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.
Bearer <<YOUR_API_KEY_HERE>>
The ID of the Automation you want to get click tracking stats for.
Automations can have multiple steps. Including step_id
as a group_by
metric allows further granularity of stats.
step_id
Comma-separated list of step_ids
that you want the link stats for.
The number of elements you want returned on each page.
1
Maximum: 50
Default: 25
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.
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const id = "f15982c1-a82c-4e87-a6b2-a4a63b4b7644";5const queryParams = {6"page_size": 257};89const request = {10url: `/v3/marketing/stats/automations/${id}/links`,11method: 'GET',12qs: queryParams13}1415client.request(request)16.then(([response, body]) => {17console.log(response.statusCode);18console.log(response.body);19})20.catch(error => {21console.error(error);22});