Email Events API - No Data Until Batch CompleteSOLVE
Oct 12, 2020 8:06 PM - edited Oct 12, 2020 8:09 PM
Here's some initial framework to help you see what's happening here. We have a weekly email that goes out, it gives users a little game where they can select option A vs. option B.
When they choose an option, they get sent to a landing page on our website.
When they hit our landing page, we want to display a simple message that says, "You chose option A and so did 45% of the other users". You get the idea, we're just seeing what the person chose in the email, and comparing it to what other people also chose in the email.
Now for the technical stuff.....
The email is being sent to our Contact List and is being sent as a "Timezone Email", so rough estimate it takes around 3/4 hours to complete. The thing is, we need the API data in real time, so when the user clicks an option on the email, we can compare their click to other clicks on the same email and display it on the landing page.
I have been using the Email Events API because we are tracking clicks, and I'm able to filter it for a time period, as well as a campaign and campaignID.
Few things to note: the campaign is the campaign the email is attached to, the campaignID is actually the Hubspot Internal ID that cooresponds to this email's send batch.
The problem I'm currently having is that I'm not able to get any API results until the batch is finished running, which ruins the idea of getting real time data.
Here's the route I'm hitting, please let me know how I can go about getting the data that I would like to receive.
The Route I'm Hitting:
The Params I'm passing:
hapikey -> our API key
limit -> the amount of results I expect to receive back
eventType -> click
startTimestamp -> 1 week ago value
campaign -> hex value of campaign the email is associated with ex. 8ecf3638-79d1-4d20-aba6-d3a1d16882a4
campaignId -> Internal Hubspot ID of the send email ex. 97084601
The Response I'm getting:
Solved! Go to Solution.
Oct 15, 2020 11:36 PM
Can you store the data in your Landing Page rather than HubSpot?
Not sure what CMS you're using for your Landing Page... But, you could increment a value (from a GET Parameter) in your database everytime the page loads. Then display the data on your page.
Would that work?