Перейти к содержимому

Goal fulfillment

Goals collection allows marking that a particular subscriber achieved (fulfilled) a particular business goal, such as «making a purchase» or «filling the questionnaire».

This could be useful if you wish to use the business goals tracking feature, but cannot use automatic tracking cookie for some reason (e.g. part of business process is outside your website).

For more information about business goals feature, contact our support.

HTTP POST method must be used to send this request.

Request data format

Data element children:

Element/attributeTypeNotes
GoalIdintegerIdentifier of business goal. Required
GoalValueintegerValue of achieved business goal. This could be price, number of points etc. If you wish to use other values than integer, convert them first (round, multiply by 100 etc). Default value is 0. Optional.
MessageGuidguid (string)Unique identifier of single message sent to subscriber. MessageGuid identifies subscriber, message, subscriber list etc.

This value originates from ExpertSender system and is generated while sending messages. You can pass it to your website by personalizing links in your messages using *[message_guid]* tag. Required.
ChannelstringChannel which was used to send message to a single subscriber. Optional. Possible values: All, Email, SmsMms, WebPush

Examples

Request:

POST https://api.esv2.com/v2/Api/Goals HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/xml
Content-Length: 298
Host: api.esv2.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <ApiKey>test_api_key1</ApiKey>
  <Data>
    <GoalId>2</GoalId>
    <GoalValue>123</GoalValue>
    <MessageGuid>C7015756-95F3-4509-8C6C-759FEEC48F91</MessageGuid>
  </Data>
</ApiRequest>

OK response:

HTTP/1.1 201 Created
Cache-Control: private
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 17 Apr 2013 11:27:02 GMT
Content-Length: 0

Error response (wrong GUID passed):

HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 24 Apr 2013 11:14:46 GMT
Content-Length: 239

<ApiResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ErrorMessage>
    <Code>400</Code>
    <Message>Message GUID was not recognized.</Message>
  </ErrorMessage>
</ApiResponse>