Refer to Event/property names reference – Datahappy for reserved event/property names.

Sending requests


API facts

HTTP method POST
Endpoint (prod) https://api.datahappy.co/v1/t
Endpoint (dev/staging) https://datahappy-api-mt-dev-uslki.ondigitalocean.app
Content-Type application/json
Accept application/json
Authorization Provide your authToken as part of the event payload (see below)

Top level params

Key name Type Required/Optional Description
projectId String Required Your unique project ID.
anonymousId String One of anonymousId or userId required An anonymous ID associated with the user e.g. generated by the datahappy Pixel
userId String One of anonymousId or userId required The database userId
event String Required if type is “track” The name of the event, either one of the standard event names or a custom one
messageId String Optional A unique identifier for the event – UUID v4 format recommended
properties Object Optional Event properties
context Object Optional Contextual info for the event (see Context params below for more info)
integrations Object Optional Parameters pertinent to any configured integrations – datahappy will enrich events with this metadata automatically so only provide to override. See Integrations below for more info.
type String Required Type of event, one of update, track or delete
channel String Required Identifies where the event was tracked from, either “web”, “mobile”, “server” or “proxy” e.g. via a CDP
timestamp String Optional Time of the event as an ISO-8601 date string (defaults to the current time if not provided)
authToken String Required A unique token provided to you to authenticate the request

Context params

All context parameters are optional.

Key name Type Description
library Object Dictionary of information about the library making the requests to the API, containing name and version.
campaign Object Dictionary of information about the campaign that resulted in the API call, containing namesourcemediumtermcontent, and any other custom UTM parameter.
device Object Dictionary of information about the device, containing idadvertisingIdmanufacturermodelnametype, and version.
app Object Dictionary of information about the current application, containing nameversion, and build.
ip String Current user’s IP address.
locale String Locale string for the current user, for example en-US.
location Object Dictionary of information about the user’s current location – possible keys: city, region, state, postalCode, country, countryCodelatitudelongitudespeed.
network Object Dictionary of information about the current network connection, containing bluetoothcarriercellular, and wifi.
os Object Dictionary of information about the operating system, containing name and version.
page Object Dictionary of information about the current page in the browser, containing pathreferrersearchtitle and url. This is automatically collected by the JS SDK.
referrer Object Dictionary of information about the way the user was referred to the website or app, containing typenameurl, and link.
screen Object Dictionary of information about the device’s screen, containing densityheight and width.
timezone String Timezones are sent as tzdata strings to add user timezone information which might be stripped from the timestamp, for example ”America/New_York”.
groupId String Group / Account ID. This is useful in B2B use cases where you need to attribute your non-group calls to a company or account.
traits Object Dictionary of traits of the current user.
userAgent String User agent of the device making the request.
externalId String The userId (if the user was already identified via a CDP pre-page load), else the anonymousId.

Integrations

Key values are always objects.

Key name Description
ga4 Contains client_id, session_id and session_number
google_ads Contains gclid, gbraid or wbraid
meta Contains the Meta cookies fbp and fbc where available and optional test_event_code
appsflyer Contains appsFlyerId
adjust Contains adid
hubspot Contains hubspotutk

Payload example

{
  "authToken": "3dcc1b7d-79a7-40d0-8886-be794d08178c",
  "projectId": "12345",
  "anonymousId": "b5c3b8d1-5db9-48bf-94e6-9aadacecaf4c", // optional
  "userId": "hasofasfoiasf",
  "event": "user_creation",
  "properties": {
    "method": "email"
  },
  "messageId": "c673b43b-3410-4028-a3ab-380f909d38c9", // optional
  "context": {
    "traits": {
      "firstName": "Bob",
      "lastName": "Tester",
      "email": "[email protected]",
      "phone": "+447748544123"
    }
  },
  "timestamp": "2022-11-11T11:48:03.754Z", // optional (for backdating)
  "channel": "server",
  "type": "track"
}

Response codes