Track pages visited by your users.
The page
call lets you track any page visited by your users.
For example, a new user may visit your "Signup" page, which you could track as follows:
Sift.page('Signup');
Calling page on every page load
We automatically call
page
in the JavaScript snippet you used to install Sift on your site so that a page is tracked immediately after your page has loaded. You must callpage
once per page load for the library to function.You may optionally call
page
more than once per full page load, for example in single page web apps.
page
method definition
Sift.page([name], [properties], [options], [callback]);
The page
call accepts the following arguments:
Argument | Type | Description |
---|---|---|
name optional | String | Name of the page, for example "Login", "Signup", "Settings" |
properties optional | Object | Free-form dictionary of properties for the page. |
options optional | Object | Free-form dictionary of options. Note: If you don't pass a properties object, you should pass an empty object {} before options |
callback optional | Function | Function executed after a brief timeout (allowing the browser time to make requests). |
We automatically track the following properties of document.location
and rename them as follows:
pathname
→path
protocol
hostname
→domain
search
→queryString
hash
→fragment
href
port
The URL we track defaults to your canonical URL first and falls back to location.href
.
The page's name
property uses document.title
as a fallback.