SMS & Email Analytics Example
Good to know
You can lear all about SMS & Email Analytics in About SMS & Email Analytics APIs
SMS & Email Analytics Example
For this example, we want to get the number of sent campaigns and the total generated revenue for all campaigns that ran on April, 20th.
1. Generate access token
To use the Analytics API endpoints you need to generate an access token. Learn more
2. Pull campaign data
Use the Campaigns endpoint to get the relevant data.
GET: https://developers.yotpo.com/messaging/v3/stores/{store_id}/analytics/source/campaigns
Example response:
{
"id": 766187,
"title": "All text subscribers",
"message": "{SiteName}: Hey {FirstName}, are you set for the Memorial Day festivities? Check our most popular items ON SALE now at: {SiteUrl} STOP to opt out\n\n{DiscountCodeUrl}",
"archived": false,
"is_ab_campaign": false,
"draft_id": null,
"status": "created",
"channel": "sms",
"created": "2021-05-25T10:44:25+00:00",
"modified": "2021-05-25T10:44:25+00:00"
},
{
"id": 3928507,
"title": "test first name 2",
"message": "",
"archived": false,
"is_ab_campaign": false,
"draft_id": null,
"status": "sent",
"channel": "email",
"created": "2023-01-15T02:18:12+00:00",
"modified": "2023-01-15T02:19:29+00:00"
},
Note: The messages will be empty for the email channel.
3. Pull flow data
Use the Flows endpoint to get the relevant data.
GET: https://developers.yotpo.com/messaging/v3/stores/{store_id}/analytics/source/flows
Example response:
{
"id": 15821,
"name": "Abandoned Cart 2 Step",
"status": false,
"is_deleted": false,
"channel": "all",
"created": "2020-02-02T09:09:10+00:00",
"modified": "2022-07-18T06:28:57+00:00"
},
{
"id": 15822,
"name": "Customer Winback 2 Step",
"status": false,
"is_deleted": true,
"channel": "sms",
"created": "2020-02-02T09:09:11+00:00",
"modified": "2023-05-01T05:06:06+00:00"
},
Please note:
When the channel is βallβ it is both SMS and email
Filtering relevant data per campaign/flow
Get to know Dimensions, Filters, and Measures
Suggested Dimensions
Dimension | Description |
---|---|
channel_type | email/sms |
source_type | campaign/flow |
source_name | The source name |
source_id | The source id |
aggregation_date | The source execution start time** |
You can explore all available dimensions by using the Dimensions endpoint
Suggested Filters
You can use Filters to get specific dimension values, for example:
source_type=campaign, channel_type=email
Suggested Measures (or metrics)
Measure | Description |
---|---|
all_sent | All messages that were sent successfully (SMS and email) |
all_delivered | All messages that were delivered (SMS and email) |
all_open | Total opens |
all_unique_open | Unique opens (only available for campaigns) |
opened_delivered_rate | Total opens out of all delivered |
unique_opened_delivered_rate | Unique opens out of all delivered |
all_clicks | Total clicks |
all_unique_clicks | Unique clicks (only available for campaigns) |
click_through_rate* | Unique clicks out of all delivered |
unique_click_through_rate* | Unique clicks out of all delivered |
all_orders | All attributed orders |
all_revenue | Total revenue |
all_unsubscribed | Total unsubscribe events |
unsubscribe_rate | Total unsubscribe events out of all delivered |
average_order_value | Average order value |
You can see an example request using suggested Measures in the Aggregations endpoint
4. Pull metrics per campaign
Use the Measures endpoint to pull all the relevant metrics.
GET: https://developers.yotpo.com/messaging/v3/stores/{store_id}/analytics/query/aggregations
Example call for pulling a list of measures, for all campaigns (sms & email):
https://developers.yotpo.com/messaging/v3/stores/{store_id}/analytics/query/aggregations?dimensions[]=channel_type&dimensions[]=source_type&dimensions[]=source_name&filters[]=source_type=campaign&dimensions[]=source_id&dimensions[]=aggregation_date&measures[]=all_sent&measures[]=all_delivered&measures[]=all_open&measures[]=all_unique_open&measures[]=opened_delivered_rate&measures[]=unique_opened_delivered_rate&measures[]=all_clicks&measures[]=all_unique_clicks&measures[]=click_through_rate&measures[]=unique_click_through_rate&measures[]=all_orders&measures[]=all_revenue&measures[]=all_unsubscribed&measures[]=unsubscribe_rate&measures[]=average_order_value
Example of how the query params look like in Postman:
Example response:
{
"channel_type": "email",
"source_type": "campaign",
"source_name": "tester",
"source_id": "379637",
"aggregation_date": "2023-05-21 12:00:00",
"all_sent": 1,
"all_delivered": 1,
"all_open": 0,
"all_clicks": 0,
"click_through_rate": 0,
"all_orders": 0,
"all_revenue": 0,
"all_unsubscribed": 0,
"unsubscribe_rate": 0,
"average_order_value": 0
},
{
"channel_type": "sms",
"source_type": "campaign",
"source_name": "Copy of New Campaign",
"source_id": "4167768",
"aggregation_date": "2023-06-14 12:00:00",
"all_sent": 0,
"all_delivered": 0,
"all_open": 0,
"all_clicks": 0,
"click_through_rate": 0,
"all_orders": 0,
"all_revenue": 0,
"all_unsubscribed": 0,
"unsubscribe_rate": 0,
"average_order_value": 0
},
5. Pull metrics per flow
Use the Aggregations endpoint. This is an example call for pulling a list of measures, for both SMS and email flows:
https://developers.yotpo.com/messaging/v3/stores/{store_id}/analytics/query/aggregations?dimensions[]=channel_type&dimensions[]=source_type&dimensions[]=source_name&filters[]=source_type=flow&dimensions[]=source_id&dimensions[]=aggregation_date&measures[]=all_sent&measures[]=all_delivered&measures[]=all_open&measures[]=all_unique_open&measures[]=opened_delivered_rate&measures[]=unique_opened_delivered_rate&measures[]=all_clicks&measures[]=all_unique_clicks&measures[]=click_through_rate&measures[]=unique_click_through_rate&measures[]=all_orders&measures[]=all_revenue&measures[]=all_unsubscribed&measures[]=unsubscribe_rate&measures[]=average_order_value
Example response:
{
"channel_type": "sms",
"source_type": "flow",
"source_name": "Post Purchase Upsell",
"source_id": "15823",
"aggregation_date": null,
"all_sent": 0,
"all_delivered": 0,
"all_open": 0,
"all_clicks": 0,
"click_through_rate": 0,
"all_orders": 0,
"all_revenue": 0,
"all_unsubscribed": 0,
"unsubscribe_rate": 0,
"average_order_value": 0
},
{
"channel_type": "email",
"source_type": "flow",
"source_name": "Welcome Flow Email & SMS",
"source_id": "153240",
"aggregation_date": "2022-03-21 10:00:00",
"all_sent": 0,
"all_delivered": 0,
"all_open": 0,
"all_clicks": 0,
"click_through_rate": 0,
"all_orders": 0,
"all_revenue": 0,
"all_unsubscribed": 0,
"unsubscribe_rate": 0,
"average_order_value": 0
},
Updated 4 months ago