Tracking

Tracking設定

Tracking設定一覧の取得 [GET]

URI引数 必須 条件 説明
limit No number 結果を取得する件数を制限します。
Example: 20
offset No number 結果を取得する位置のオフセットを指定します。
Example: 1

Request

1
GET https://api.sendgrid.com/v3/tracking_settings?limit={limit}&offset={offset} HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 200
{
  "result": [
    {
      "name": "open",
      "title": "Open Tracking",
      "description": "lorem ipsum... .",
      "enabled": true
    }
  ]
}

Click Tracking設定の取得 [GET]

Request

1
GET https://api.sendgrid.com/v3/tracking_settings/click HTTP/1.1

Response

1
2
3
4
HTTP/1.1 200
{
  "enabled": true
}

Click Tracking設定の更新 [PATCH]

Request

1
PATCH https://api.sendgrid.com/v3/tracking_settings/click HTTP/1.1
Request Body
1
2
3
{
  "enabled": true
}

Response

1
2
3
4
HTTP/1.1 200
{
  "enabled": true
}

Google Analytics設定の取得 [GET]

Request

1
GET https://api.sendgrid.com/v3/tracking_settings/google_analytics HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
HTTP/1.1 200
{
  "enabled": true,
  "utm_source": "sendgrid.com",
  "utm_medium": "email",
  "utm_term": "",
  "utm_content": "",
  "utm_campaign": "website"
}

Google Analytics設定の更新 [PATCH]

Request

1
PATCH https://api.sendgrid.com/v3/tracking_settings/google_analytics HTTP/1.1
Request Body
1
2
3
4
5
6
7
8
{
  "enabled": true,
  "utm_source": "sendgrid.com",
  "utm_medium": "email",
  "utm_term": "",
  "utm_content": "",
  "utm_campaign": "website"
}

Response

1
2
3
4
5
6
7
8
9
HTTP/1.1 200
{
  "enabled": true,
  "utm_source": "sendgrid.com",
  "utm_medium": "email",
  "utm_term": "",
  "utm_content": "",
  "utm_campaign": "website"
}

Open Tracking設定の取得 [GET]

Request

1
GET https://api.sendgrid.com/v3/tracking_settings/open HTTP/1.1

Response

1
2
3
4
HTTP/1.1 200
{
  "enabled": true
}

Open Tracking設定の更新 [PATCH]

開封トラッキングで使用される画像は、初期状態でメールの最後に挿入されます。SMTP APIヘッダと置換タグを使用することでその場所を変更することができます。

v3 Mail Sendエンドポイント経由で送信している場合、open_trackingenableパラメータをtrueにして、substitution_tagパラメータで文字列を指定することで置換タグを指定できます。SendGridはメール本文内のsubstitution_tagで指定した文字列を画像に置換します。

Request

1
PATCH https://api.sendgrid.com/v3/tracking_settings/open HTTP/1.1
Request Body
1
2
3
{
  "enabled": true
}

Response

1
2
3
4
HTTP/1.1 200
{
  "enabled": true
}

Subscription Tracking設定の取得 [GET]

Request

1
GET https://api.sendgrid.com/v3/tracking_settings/subscription HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
HTTP/1.1 200
{
  "enabled": true,
  "landing": "landing page html",
  "url": "url",
  "replace": "replacement tag",
  "html_content": "html content",
  "plain_content": "text content"
}

Subscription Tracking設定の更新 [PATCH]

Request

1
PATCH https://api.sendgrid.com/v3/tracking_settings/subscription HTTP/1.1
Request Body
1
2
3
4
5
6
7
8
{
  "enabled": true,
  "landing": "landing page html",
  "url": "url",
  "replace": "replacement tag",
  "html_content": "html content",
  "plain_content": "text content"
}

Response

1
2
3
4
5
6
7
8
9
HTTP/1.1 200
{
  "enabled": true,
  "landing": "landing page html",
  "url": "url",
  "replace": "replacement tag",
  "html_content": "html content",
  "plain_content": "text content"
}