API Event
The event API can be used to record page views and custom events. This is useful when monitoring Android or iOS mobile apps or for server-side monitoring.
We recommend you to install Vantevo via our provided script or one of the many integration packages listed here. However, if there is no easy way to integrate with Vantevo, you can still do so by sending events directly to our API.
POST /v1/event​
Record a pageview or custom event.
Very important: make sure to send the correct headers:
- User-Agent is used to determine the user’s device
- X-Forwarded-For is used to determine the IP address of the client and create the session
- Content-Type must be application/json
Example​
curl --location --request POST 'https://api.vantevo.io/v1/event'
--header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
--header 'X-Forwarded-For: 127.0.0.1'
--header 'Content-Type: application/json'
--data-raw '{ "event": "pageview", "url": "https://www.example.com", referrer: null, "width": 0, "height": 0, domain: null, "meta": {} }'
Parameters​
Option | Type | Description | Default |
---|---|---|---|
event | string (Required) | For the page views you have to use pageview . For a custom event you can use any name for your event. | pageview |
url | string (Required) | The URL of the page where the event was activated. If the URL contains UTM parameters , they will be used. The Vantevo script uses window.location.href for this field. The URL format must be: https://example.com/page | null |
title | string (Optional) | The title of the page, if it is not provided Vantevo will write the url as a title | null |
referrer | string (Optional) | Referrer for this event. The vantevo script uses document.referrer for this field. | null |
width | number (Optional) | The Vantevo script uses “window.innerWidth” for this field. | 0 |
height | number (Optional) | The Vantevo script uses “window.innerHeight” for this field. | 0 |
domain | string (Optional) | The domain name registered on Vantevo Analytics, to be used only in case the url field has a different domain. This is the domain name you used when you added your website to your Vantevo account. | null |
meta | Object (Optional) | Custom properties for the event. See Meta properties for custom events | {} |