verified
Retrieve clicks from an email sendLearn how to retrieve the number of clicks and other link information from an email send in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include WSProxy method.
WSProxy
var api = new Script.Util.WSProxy();
var cols = [
"ID",
"SendID",
"Client.ID",
"Client.PartnerClientKey",
"Link.ID",
"Link.TotalClicks",
"Link.UniqueClicks",
"Link.URL",
"Link.Alias"
];
var result = api.retrieve("LinkSend", cols, {
Property: "SendID",
SimpleOperator: "equals",
Value: ["123456"]
});
<script runat="server">
Platform.Load("core", "1");
var api = new Script.Util.WSProxy();
try {
var cols = [
"ID",
"SendID",
"Client.ID",
"Client.PartnerClientKey",
"Link.ID",
"Link.TotalClicks",
"Link.UniqueClicks",
"Link.URL",
"Link.Alias"
];
var result = api.retrieve("LinkSend", cols, {
Property: "SendID",
SimpleOperator: "equals",
Value: ["123456"]
});
Write(Stringify(result));
} catch(error) {
Write(Stringify(error));
}
</script>
{
"Status": "OK",
"RequestID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"Results": [
{
"SendID": 1234567,
"Link": {
"LastClicked": "0001-01-01T00:00:00.000",
"Alias": "https://www.mywebsite.com/",
"TotalClicks": 16,
"UniqueClicks": 7,
"URL": "https://www.mywebsite.com/",
"Subscribers": null,
"IDLong": 0,
"Client": null,
"PartnerKey": null,
"PartnerProperties": null,
"CreatedDate": "0001-01-01T00:00:00.000",
"ModifiedDate": null,
"ID": 11223344,
"ObjectID": null,
"CustomerKey": null,
"Owner": null,
"CorrelationID": null,
"ObjectState": null,
"IsPlatformObject": false
},
"IDLong": 0,
"Client": {
"ID": 987654321,
"ClientID1": 0,
"PartnerClientKey": null,
"UserID": 0,
"PartnerUserKey": null,
"CreatedBy": 0,
"ModifiedBy": 0,
"EnterpriseID": 0,
"CustomerKey": null,
"CustomerID": null
},
"PartnerKey": null,
"PartnerProperties": null,
"CreatedDate": "0001-01-01T00:00:00.000",
"ModifiedDate": null,
"ID": 123456789,
"ObjectID": null,
"CustomerKey": null,
"Owner": null,
"CorrelationID": null,
"ObjectState": null,
"IsPlatformObject": false
}
],
"HasMoreRows": false
}
WARNING
SendID refers to the unique identifier for a specific send (JobID in the Send Log).
Reference
Ressources and references related to the current methods.
SOAP object