Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The identify call has the following fields:

FIELD

DETAILS

userId String, optional

The ID for this user in your database. Note: at least one of userId or anonymousId must be included in any identify call.

anonymousId String, optional

An ID associated with the user when you don’t know who they are (for example, the anonymousId generated by analytics.js). Note: You must include at least one of userId or anonymousId in all identify calls.

traits Object, optional

A dictionary of traits you know about the user. Things like: email, firstname or lastname.

timestamp Date, optional

A JavaScript date object representing when the identify took place. If the identify just happened, leave it out as journy.io uses the server’s time. If you’re importing data from the past make sure to send a timestamp.

context Object, optional

A dictionary of extra context to attach to the call. Note: context differs from traits because it is not attributes of the user itself.

Identifying users happen incremental: You can identify users with a subset of traits; and later make another identify call with another subset of traits. The result of both identify calls will be the union of all traits.

...

The group call has the following fields:

FIELD

DETAILS

userId String, optional

The ID for this user in your database. _Note: at least one of userId or anonymousId must be included in any group call.

anonymousId String, optional

An ID associated with the user when you don’t know who they are (eg., the anonymousId generated by analytics.js). Note: at least one of userId or anonymousId must be included in any group call.

groupId _string

The ID of the group.

traits dict, optional

A dict of traits you know about the group. For a company, they might be things like name, address, or phone.

context dict, optional

A dict containing any context about the request.

timestamp datetime, optional

A datetime object representing when the group took place. If the group just happened, leave it out and we’ll use the server’s time. If you’re importing data from the past make sure you send timestamp.

Note

To identify a group, without adding a user, you can use anonymousId with the same value of the groupId. It goes like this:

Code Block
analytics.group({ 
   anonymousId: "xyz789", //Tesla Inc — unique Id from database
   groupId: "xyz789", //Tesla Inc — unique Id from database
   traits: { 
      name: "Tesla Inc", 
      industry: "Automotive" } 
});

...

The track call has the following fields:

FIELD

DETAILS

userId String, optional

The ID for this user in your database. _Note: at least one of userId or anonymousId must be included in any track call.

anonymousId String, optional

An ID associated with the user when you don’t know who they are (for example, the anonymousId generated by analytics.js). Note: You must include at least one of userId or anonymousId in all track calls.

event String

The name of the event you’re tracking. We recommend human-readable names like Song Played or Status Updated.

properties Object, optional

A dictionary of event metadata for the event. If the event was Product Added, it might have metadata like total amount or currency.

timestamp Date, optional

A JavaScript date object representing when the track took place. If the track just happened, leave it out and we’ll use the server’s time. If you’re importing data from the past make sure you to send a timestamp.

context Object, optional

A dictionary of extra context to attach to the call. Note: context differs from traits because it is not attributes of the user itself.

Find details on best practices in event naming as well as the track method payload in the journy.io Spec.

...

The page method lets you record page views on your website, along with optional extra information about the page being viewed. It is also user to record screen views in your app/on your platform. ⚠️

Note

Important Note:

  • When a name is provided in the page call,

...

  • journy.io will collect those calls and stores them as (app) screen objects.

  • Without name,

...

  • journy.io regards those calls as (website) page objects.

If you’re using our client-side set up in combination with the Node.js library, page calls are already tracked for you by default. However, if you want to record your own page views manually and aren’t using our client-side library, read on!

...

The page call has the following fields:

FIELD

DETAILS

userId String, optional

The ID for this user in your database. _Note: at least one of userId or anonymousId must be included in any page call.

anonymousId String, optional

An ID associated with the user when you don’t know who they are (eg., the anonymousId generated by analytics.js). Note: at least one of userId or anonymousId must be included in any page call.

category String, optional

The category of the page. Useful for things like ecommerce where many pages often live under a larger category.

name String, optional

The name of the page, for example Signup or Home. Providing a name will determine if

http://

journy.io will record a screen (with name) or a page (without name).

properties Object, optional

A dictionary of properties of the page. A few properties specially recognized and automatically translated: url, title, referrer and path, but you can add your own too.

timestamp Date, optional

A JavaScript date object representing when the track took place. If the track just happened, leave it out and we’ll use the server’s time. If you’re importing data from the past make sure you to send a timestamp.

context Object, optional

A dictionary of extra context to attach to the call. Note: context differs from traits because it is not attributes of the user itself.

Find details on the page payload in the http:// journy.io Spec.

Configuration

The second argument to the Analytics constructor is an optional list of settings to configure the module.

Code Block
const analytics = new Analytics({ 
   writeKey: "<YOUR_WRITE_KEY>", 
   host: "https://analyze.journy.io", 
   path: "/backend/v1/batch", 
   maxRetries: 3, 
   maxEventsInBatch: 15, 
   flushInterval: 10000, 
   disable: false 
})

SETTING

DETAILS

writeKey string

The key that corresponds to your

http://

journy.io SDK connector

host string

The base URL of the API. The default is: “https://analyze.journy.io”

path string

The API path route. The default is: “backend/v1/batch”

maxRetries number

The number of times to retry flushing a batch. The default is: 3

maxEventsInBatch number

The number of messages to enqueue before flushing. The default is: 15

flushInterval number

The number of milliseconds to wait before flushing the queue automatically. The default is: 10000

httpRequestTimeout number

The maximum number of milliseconds to wait for an http request. The default is: 10000

disable boolean

Disable the analytics library for testing. The default is: false

httpClient HTTPClient or HTTPClientFn

A custom HTTP Client implementation to support alternate libraries or proxies. Defaults to global fetch or node-fetch for older versions of node.

Graceful shutdown

Avoid losing events after shutting down your console. Call .closeAndFlush() to stop collecting new events and flush all existing events. If a callback on an event call is included, this also waits for all callbacks to be called, and any of their subsequent promises to be resolved.

...

Code Block
const analytics = new Analytics({ 
   writeKey: "<YOUR_WRITE_KEY>",
   host: "https://analyze.journy.io", 
   path: "/backend/v1/batch" 
}) 

analytics.on("error", (err) => console.error(err))