Events
Events are the power behind Plunk's email marketing automations. They are the triggers that start your automations. Events are triggered by a user's actions on your site, such as signing up for your newsletter, or making a purchase.
POST /v1/track
Triggers an event and creates it if it doesn't exist.
Authorization
This endpoint can be accessed with both the public
and private
API keys. Meaning that you can trigger events from both the client and the server.
Returns
A JSON object containing the success status and the contact's ID.
{
"success": true,
"contact": "80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
}
Example
await fetch('https://api.useplunk.com/v1/track', {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY", // Put your API key here
},
body: JSON.stringify({
"event": "new-project",
"email": "hello@useplunk.com",
}),
});
import requests
requests.post(
"https://api.useplunk.com/v1/track",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY" # Put your API key here
},
json={
"event": "new-project",
"email": "hello@useplunk.com",
},
)
curl --location --request POST 'https://api.useplunk.com/v1/track' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"email": "hello@useplunk.com", "event": "new-project"}'
<?php
$client = new Client();
$request = new Request('POST', 'https://api.useplunk.com/v1/track', ['Authorization' => 'Bearer API_KEY', 'Content-Type' => 'application/json'], '{
"event": "new-project",
"email": "hello@useplunk.com",
}');
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/track")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer API_KEY" # Put your API key here
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"event": "new-project",
"email": "hello@useplunk.com",
})
response = https.request(request)