session_start Event
Definition
This document provides a detailed walkthrough of the fireing session_start built-in event
Triggers and Dispatch Conditions of the session_start Event
The Pulse SDK triggers the session_start event in the following scenarios:
- When the user visits the page for the first time.
- When the user accepts the cookie consent.
- When more than 30 minutes have passed since the last activity, and the user performs a new action on the page, such as clicking a button.
- The new device id has been provided by the server
- The URL contains UTM campaign parameters for the first time or the parameters differ from the last one
- The URL contains mkt_click(gclid: google click id, fbclid: Facebook click id, etc.) parameters in the URL
Cases when the session_start event should not be fired:
- The browser already opened a page with the same domain and the session has not expired on that tab(the session will expire 30 minutes after the last activity)
- Session data is in the browser storage and the session is not expired
- Session data is in the browser storage, the session is not expired and the page URL doesn’t contain UTM parameters or mkt_click parameters
The schema of a session_start event
{
data: {
previous_url?: string
referrer?: string
tab_id?: string
url: string
landing_page_url?: string
mkt_click?: { id: string, source: string }
utm_params?: {
utm_source: string
utm_campaign: string
utm_medium: string
utm_term: string
utm_content: string
}
},
event: "session_start",
timestamp: number
}
session_start event parameters
previous_url
The previous_url parameter is an optional parameter.
The parameter is taken by "tracking SDK" from the navigation history.
Cases when the previous_url parameter should be in the session_start event:
- The navigation happened before the
previous_urlevent firing (it doesn't matter how long ago the navigation event occurred)
url
The url parameter is a mandatory parameter in the session_start event.
The parameter is taken by "tracking SDK" from the Browser API window.location.href, this is the URL of the page where the session_start event occurred.
tab_id
The tab_id parameter is an optional parameter.
The tracking SDK generates a new tab_id each time when a new tab opens and there is no preselected configuration for tracking SDK not to track tab_id.
Cases when the tab_id parameter should not be in the session_start event:
- The tracking SDK has been initialized with configuration restricting tracking tab_id
referrer
The referrer parameter is an optional parameter.
The parameter is taken by "tracking SDK" from the Browser API window.document.referrer or if the referrer value is empty SDK will try to get the previous URL parameter if the previous URL is also empty the referrer won’t be sent in session_start event.
Cases when the referrer parameter should be in the session_start event:
- The browser
window.document.referrerhas a value
The browser window.document.referrer has no value but some navigation happened in the tab before the session_start event occurred, the referrer parameter’s value will be the previous URL
Cases when the referrer parameter should not be in the session_start event:
- The browser
window.document.referrerhas no value and previously no navigation event happened
landing_page_url
The landing_page_url parameter is an optional parameter.
The parameter shows the URL where the user lands on the application first time.
Cases when the landing_page_url parameter should not be in the session_start event:
- There are no UTM parameters or
mkt_clickparameters or referrer parameter
mkt_click
The mkt_click parameter is an optional parameter.
The parameter is taken by "tracking SDK" from the page URL parameters:
gclidgoogle click idgclsrcgoogle click sourcemsclkidmicrosoft click idfbclidfacebook click idyclidyandex click id
Cases when the mkt_click should be in the session_start event:
- Page URL contains
mkt_clickid parameters mentioned above
utm_params
The mkt_click parameter is an optional parameter.
The parameter is taken by "tracking SDK" from the page URL parameters:
utm_sourceCampaign Source - This parameter identifies the source of the traffic. This could be a website name, search engine, newsletter name, or social network.utm_mediumCampaign Medium - This parameter identifies the medium used to share and access the link. This could be email, social, cost per click (CPC), or another method.utm_campaignCampaign Name - This parameter identifies a campaign or promotion tied to the link. This could be a product name, type of sale, contest name, etc.utm_termCampaign Term - This parameter is for paid search campaigns to track relevant ad-based keywords. This helps to identify which keyword(s) resulted in a site visit.utm_contentCampaign Content - This parameter determines what someone clicked on to get to the site when there are multiple links pointing to the same URL, such as in an email or on a landing page with multiple CTAs. This parameter is also used to distinguish between ads pointing to the same URL. It is commonly used for A/B testing and content-targeted ads.
Cases when the utm_params should be in the session_start event:
- Page URL contains UTM parameters mentioned above