One of MetricsWave's most powerful features is the ability to record custom events and obtain information from them.
Events, along with custom parameters, will allow you to view statistics and understand how users are using your application.
The first thing it's to create your event. You can do this in the Event
view inside our application.
Add a title, a description and all the params that you want to attach if any. After creating the event copy and save the event UUID. You will need it.
Now you just need to trigger the event in your application. This is as simple as making a fetch request to the endpoint with the event UUID you just copied.
fetch(
`https://metricswave.com/webhooks/${eventUuid}?email=hi@metricswave.com`
)
If you are logging your traffic using our visits script. You can log an event window.metricswave()
function.
window.metricswave(eventUuid, {email: 'hi@metricswave.com'})
You can also, if you prefer, send a POST request with the params in a json body. In this case it will be something like
this {email: "any@email.com"}
.
With POST request is important to set Content-Type: application/json
and Accept: application/json
headers. Here you
can find an example of a request made from bash terminal.
BODY='{"email": "my@email.com"}'
curl -X POST https://metricswave.com/webhooks/[[EVENT-UUID]] \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "$BODY"
Same trigger with different emojis
All events have a hidden emoji
parameter. This parameter gives you the option to dynamically change the emoji.
Just add the param &emoji=😍
at the end of your GET request, or as a param in your POST, and the notification will be
triggered with this emoji instead of the one configured in the Trigger.
Start for free, and upgrade your account at any moment.