1

我正在尝试发送电子邮件模板以及应使用 SparkPost API 跟踪其点击次数的 URL?

示例:如果我给 www.google.com 它必须更改为

http://go.sparkpostmail1.com/f/a/EgvUoS2LdGPzMx-AURKwZA~~/AABUGAA~/RgRZK0BSP0EIAGukLuGW3OxXA3NwY1gEAAAAAFkGc2hhcmVkQgoAAVK7SFdpNVEbUhFuaWNvbGFzQGR1cmFuZC5jaAlRBAAAAABEUWh0dHBzOi8vZGlzaGx5Lm1lbnUvZC9XYXNoaW5ndG9uL1JlZ2VudF9UaGFpL0Jhc2lsX0phZS81NjBmMzk5MmQ0YWUxNTAzMDBmZWZmMGIiLEcCe30 .

POST /api/v1/transmissions?num_rcpt_errors=3

 {
  "options": {
    "start_time": "now",
    "open_tracking": true,
    "click_tracking": true,
    "transactional": false,
    "sandbox": false,
    "ip_pool": "sp_shared",
    "inline_css": false
  },
  "description": "Christmas Campaign Email",
  "campaign_id": "christmas_campaign",
  "metadata": {
    "user_type": "students",
    "education_level": "college"
  },
  "substitution_data": {
    "sender": "Big Store Team",
    "holiday_name": "Christmas"
  },
  "recipients": [
    {
      "address": {
        "email": "wilma@flintstone.com",
        "name": "Wilma Flintstone"
      },
      "tags": [
        "greeting",
        "prehistoric",
        "fred",
        "flintstone"
      ],
      "metadata": {
        "age": "24",
        "place": "Bedrock"
      },
      "substitution_data": {
        "customer_type": "Platinum",
        "year": "Freshman"
      }
    }
  ],
  "content": {
    "from": {
      "name": "Fred Flintstone",
      "email": "fred@flintstone.com"
    },
    "subject": "Big Christmas savings!",
    "reply_to": "Christmas Sales <sales@flintstone.com>",
    "headers": {
      "X-Customer-Campaign-ID": "christmas_campaign"
    },
    "text": "Hi  \nSave big this Christmas in your area ! \nClick http://www.example.com and get huge discount\n Hurry, this offer is only to \n ",
    "html": "<p>Hi  \nSave big this Christmas in your area ! \nClick http://www.example.com and get huge discount\n</p><p>Hurry, this offer is only to \n</p><p></p>"
  }
}
4

1 回答 1

0

要启用“点击跟踪”,请options.click_tracking=true在您的请求中设置字段。您已经这样做了,但看起来您的链接content.html不是 HTML 锚(<a>标签),而只是纯文本链接。

SparkPost 只会跟踪 HTML 锚点,所以我建议更改此设置:

http://www.example.com

对此:

<a href="http://www.example.com">www.example.com</a>

于 2016-09-15T12:45:32.727 回答