Event: Page

The page method can record whenever a user sees a page of your website, along with any optional properties about the page.

How to make a page call

You can call page or screen using one of our data tracking libraries.

Note: In Plainflow.js a page call is included in the snippet by default just after plainflow.load. We do that because you must call this method at least once per page load. However, you can choose to add an optional name or properties to the default call, or call it multiple times if you have a single-page application (SPA).

Here’s the payload of a typical page call without any common field:

{
  "type": "page",
  "name": "Home",
  "properties": {
    "title": "Plainflow | Customer data platform for better customer experiences",
    "url": "http://www.plainflow.com"
  }
}

And here’s the corresponding Javascript event that would generate the above payload. If you’re using the Plainflow.js Javascript library, the page name and URL are automatically gathered and passed as properties into the event payload:

plainflow.page("Home");

Page fields

Beyond the common fields, the page call takes the following fields:

FieldTypeDescription
name optionalStringName of the page.
properties optionalObjectFree-form dictionary of properties of the page, like url and referrer See the Properties field docs for a list of reserved property names
category optionalStringThe category of the page. Useful for things like ecommerce where many pages often live under a larger category.

Identities

The User ID is a unique identifier for the user performing the actions. Check out the User ID docs for more detail.

The Anonymous ID can be any pseudo-unique identifier, for cases where you don’t know who the user is, but you still want to tie them to an event. Check out the Anonymous ID docs for more detail.

Note: In our browser and mobile libraries a User ID is automatically added from the state stored by a previous identify call, so you do not need to add it yourself. They will also automatically handle Anonymous ID’s under the covers.

Properties and reserved keywords

Properties are extra pieces of information that describe the page. They can be anything you want.

We’ve reserved some properties that have semantic meanings, and we handle them in special ways. For example, we always expect path to be the URL path of a page, and referrer to be the URL of the previous page.

You must only use reserved properties for their intended meaning.

Reserved properties we have standardized:

PropertyTypeDescription
nameStringName of the page.
pathStringPath portion of the URL of the page. Equivalent to location.pathname from the DOM API.
referrerStringFull URL of the previous page. Equivalent to document.referrer from the DOM API.
searchStringQuery string portion of the URL of the page. Equivalent to location.search from the DOM API.
titleStringTitle of the page. Equivalent to document.title from the DOM API.
urlStringFull URL of the page. First we look for the canonical url. If the canonical url is not provided, we use location.href from the DOM API.
category optionalStringThe category of the page. Useful for things like ecommerce where many pages often live under a larger category.

Note: In Plainflow.js, we automatically send the following properties: title , path, url, referrer, and search.

Example

Here’s a complete example of a page call:

  {
    "anonymousId": "59f75a945b289f44d6e8aca5",
    "channel": "browser",
    "context": {
      "ip": "8.8.8.8",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.32 (KHTML, like Gecko) Version/8.1 Safari/601.1.32"
    },
    "messageId": "aaf06138-2ceb-4881-9c73-79a1c782f370",
    "name": "Home",
    "category": "cornestone-pages",
    "properties": {
      "title": "Welcome | Initech",
      "url": "http://www.initech.com"
    },
    "receivedAt": "2017-02-09T12:08:32.387Z",
    "sentAt": "2017-02-23T22:28:55.111Z",
    "timestamp": "2017-02-23T22:28:55.111Z",
    "type": "page",
    "userId": "97980cfea0067",
    "version": "1.1"
  }

Not using Plainflow yet? Get your free account here. 👈