Menu

Expand
Rate this page:

Marketing Campaign Stats

The Marketing Campaigns Stats endpoints allow you to retrieve stats for both Automations and Single Sends.

Note: These endpoints provide stats for Marketing Campaigns only. For stats related to event tracking, please see the Stats section under Event Tracking below.

Get Automation Click Tracking Stats by ID

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

  • API Key

Headers

Authorization
string
default: Bearer <<YOUR_API_KEY_HERE>>
required

Path Parameters

id
string

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

default: None
required

Query String

group_by
array

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

default: None
step_ids
array

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

default: None
page_size
integer

The number of elements you want returned on each page, from 1 to 50.

default: 25
page_token
string

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.

default: None

Responses

object
results
array[object]
required
url
string

This is the URL of the link clicked. If {{custom_fields}} are part of the URL, they will be included.

format: uri
required
url_location
integer

This is the location of the link clicked in each Automation step. Links are located according to their position within the message; the topmost link has index 0.

minimum: 0
step_id
string

This is the ID of the step if the stats were requested to be grouped by step_id.

format: uuid
required
clicks
integer

The number of clicks on this particular link.

minimum: 1
required
total_clicks
integer
required
_metadata
object
required
prev
string

The URL of the previous page of results. If this field isn't present, you're at the start of the list.

format: uri
self
string

The URL of the current page of results.

format: uri
next
string

The URL of the next page of results. If this field isn't present, you're at the end of the list.

format: uri
count
number

The number of items in the entire list, i.e., across all pages.

object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
Loading Code Sample...
        
        

        Get Automation Click Tracking Stats by ID

        Rate this page:

        Need some help?

        We all do sometimes. Get help now from the Twilio SendGrid Support Team.

        Running into a coding hurdle? Lean on the wisdom of the crowd by browsing the SendGrid tag on Stack Overflow or visiting Twilio's Stack Overflow Collective.

        Loading Code Sample...
              
              
              

              Thank you for your feedback!

              Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              thanks-feedback-gif