Skip to contentSkip to navigationSkip to topbar
On this page

Get Single Send 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/singlesends/{id}/links

Base url: https://api.sendgrid.com (The Twilio SendGrid v3 API)

This endpoint lets you retrieve click-tracking stats for one Single Send.

The stats returned list the URLs embedded in the specified Single Send and the number of clicks each one received.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
idstringrequired

The ID of Single Send for which you want to retrieve link stats.

Property nameTypeRequiredDescription
page_sizeinteger

Optional

The number of elements you want returned on each page.

Minimum: 1Maximum: 50Default: 25

page_tokenstring

Optional

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.


group_byarray[enum<string>]

Optional

A/B Single Sends have multiple variation IDs and phase IDs. Including these additional fields allows further granularity of stats by these fields.

Possible values:
ab_variationab_phase

ab_variation_idstring<uuid>

Optional


ab_phase_idenum<string>

Optional

Possible values:
testsend
200400404
Schema
Property nameTypeRequiredDescriptionChild properties
resultsarray[object]

This is the index of the link's location in the email contents.


_metadataobject

total_clicksinteger
Get Single Send Click Tracking Stats by IDLink to code sample: Get Single Send Click Tracking Stats by ID
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const id = "ZGkrHSypTsudrGkmdpJJ";
5
const queryParams = {
6
page_size: 25,
7
};
8
9
const request = {
10
url: `/v3/marketing/stats/singlesends/${id}/links`,
11
method: "GET",
12
qs: queryParams,
13
};
14
15
client
16
.request(request)
17
.then(([response, body]) => {
18
console.log(response.statusCode);
19
console.log(response.body);
20
})
21
.catch((error) => {
22
console.error(error);
23
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.