Log in

Page event

Endpoint

1
POST https://api.june.so/sdk/page

Purpose

This action is used to track pageviews.

Response

Returns a JSON response with a status of 200 and a success key set to true.

1
{
2
"status": 200,
3
"success": true
4
}

Parameters

Parameter
Type
Description
Required
properties
Object
A dictionary of properties for the event. It should contain required pageview properties, but it can also contain any custom properties you like.
Required
userId
String
The ID for this user in your database. Note: At least one of `userId` or `anonymousId` must be included in any track call.
Optional
anonymousId
String
An ID associated with the user when you don’t know who they are.
Optional
timestamp
Date
A JavaScript date object representing when the track took place. If the track just happened, leave it out and the server’s time will be used. If you’re importing data from the past, make sure to send a timestamp.
Optional
context
Object
A dictionary of extra context to attach to the call.
Optional

Pageview suggested properties

We don't require any properties for pageview events, but we recommend you send the following properties to get the most out of June.

Parameter
Type
Description
Required
url
Object
The URL of the page that the user is currently on
Optional
path
String
The path portion of the URL of the page that the user is currently on
Optional
title
String
The title of the page that the user is currently on
Optional
referrer
String
The referrer of the page that the user is currently on
Optional
search
String
The search portion of the URL of the page that the user is currently on
Optional

Pageview suggested context

We don't require any context for pageview events, but we recommend you to send context in the following structure.

Parameter
Type
Description
Required
app
Object
Dictionary of information about the current application, containing name, version, and build. This is collected automatically from the mobile libraries when possible.
Optional
campaign
Object
Dictionary of information about the campaign that resulted in the API call, containing name, source, medium, term, content, and any other custom UTM parameter. This maps directly to the common UTM campaign parameters.
Optional
device
Object
Dictionary of information about the device, containing id, advertisingId, manufacturer, model, name, type, and version.
Optional
ip
String
Current user’s IP address.
Optional
locale
String
Locale string for the current user, for example en-US.
Optional
os
Object
Dictionary of information about the operating system, containing name and version.
Optional
referrer
Object
Dictionary of information about the way the user was referred to the website or app, containing type, name, url, and link.
Optional
screen
Object
Dictionary of information about the device’s screen, containing density, height, and width.
Optional
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.
Optional
groupId
String
Group / Account ID.
Optional
userAgent
String
User agent of the device making the request.
Optional

Basic example

1
POST https://api.june.so/sdk/page
2
3
{
4
"userId": "1234567890",
5
"properties": {
6
"url": "https://june.so/docs",
7
"path": "/docs",
8
"title": "June | Docs",
9
"referrer": "https://june.so",
10
"search": "?utm_source=google&utm_medium=cpc&utm_campaign=summer",
11
},
12
}

Example with context

1
POST https://api.june.so/sdk/page
2
3
{
4
"userId": "1234567890",
5
"properties": {
6
"url": "https://june.so/docs",
7
"path": "/docs",
8
"title": "June | Docs",
9
"referrer": "https://june.so",
10
"search": "?utm_source=google&utm_medium=cpc&utm_campaign=summer",
11
},
12
"context": {
13
"app": {
14
"name": "June",
15
"version": "1.0.0",
16
"build": "1.0.0",
17
},
18
"campaign": {
19
"name": "summer",
20
"source": "google",
21
"medium": "cpc",
22
"term": "summer",
23
"content": "summer",
24
},
25
"device": {
26
"id": "1234567890",
27
"advertisingId": "1234567890",
28
"manufacturer": "Apple",
29
"model": "iPhone",
30
"name": "iPhone",
31
"type": "mobile",
32
"version": "1.0.0",
33
},
34
"ip": "127.0.0.1",
35
"locale": "en-US",
36
"os": {
37
"name": "iOS",
38
"version": "1.0.0",
39
},
40
"referrer": {
41
"type": "website",
42
"name": "June",
43
"url": "https://june.so",
44
"link": "https://june.so",
45
},
46
"screen": {
47
"density": 2,
48
"height": 1334,
49
"width": 750,
50
},
51
"timezone": "America/New_York",
52
"groupId": "1234567890",
53
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",
54
},
55
}