1. Predefined Events

Event English Variable NameEvent Display NameProperty English Variable NameEvent Property Display NameProperty Value TypeTrigger TimeDescriptionRemarks
$MPLaunchMini Program Launch
$Preset Properties
When the Mini Program is killed and reopened, and sa.quick('appLaunch', options) is called in the corresponding Mini Program lifecycle function, it will be triggered.Triggered only once when the Mini Program is initialized
$sceneLaunch SceneString
$url_pathPage PathString
$is_first_timeIs First TimeBoolean
$utm_sourceStringAdvertising Campaign Source
$utm_mediumStringAdvertising Campaign Medium
$utm_termStringAdvertising Campaign Term
$utm_contentStringAdvertising Campaign Content
$utm_campaignStringAdvertising Campaign Name
$MPShowMini Program Display
$Preset Properties
When the mini program is launched, or when it is brought to the foreground from the background and sa.quick('appShow', options) is called in the corresponding mini program lifecycle function.

When the mini program is launched
$sceneLaunch SceneString
$url_pathPage PathString
$utm_sourceStringAdvertising Campaign Source
$utm_mediumStringAdvertising Campaign Media
$utm_termStringAdvertising Campaign Keyword
$utm_contentStringAdvertising Campaign Content
$utm_campaignStringAdvertising Campaign Name
$MPHideMiniprogram to Background
$Preset Properties
When user exits the mini program by clicking the upper-right corner exit button, switching to another App, entering the about page, locking screen, or the mini program process is killed and sa.quick('Hide') is called in the corresponding mini program lifecycle function,
Miniprogram from Foreground to Background
$event_durationDuration on pageValue
$url_pathPage pathString
$MPViewScreenMini program page view
$Preset Properties
Triggered when a mini program is launched, a page is opened within a mini program, or when the app is brought to the foreground from the backgroundCalled each time a page is opened

Not supported for mini programs developed with the uni-app framework

Supported from version v0.6.0 and later


$url_pathPage pathString
$MPClickMini program element click
$Preset Properties
Triggered when a Mini Program page element is clickedOnly collected when the element being clicked has added listeners using bindtap/bindlongtap/bindlongpress
$element_idElement IDString
$element_nameElement NameString
$element_contentElement ContentString
$element_typeElement TypeString
$url_pathPage PathString

2. Predefined attribute for all events

Field NameTypeDescriptionRemark
$libStringSDK TypeThe value for Baidu Mini Program SDK is SmartProgram
$lib_versionStringSDK Version
$app_idStringAppID of Baidu Mini Program (Smart Mini Program ID)Supported from version 0.8.0 and above
$screen_heightNumericScreen Height
$screen_widthNumericScreen width
$modelStringDevice model
$manufacturerStringDevice manufacturer
$osStringOperating system
$os_versionStringOperating system version
$is_first_dayBoolean ValueWhether it is the first day of visit (true for values between the first visit of new users and midnight on that day, false afterwards, indicating it exists in storage)
$is_login_idBoolean ValueWhether it is the login ID (determined and added when data is stored)
$ipStringAttribute carried when SDK sends data request
$timezone_offsetNumberTimezone offsetSupported in version 0.8.0 and above
$countryStringObtained by IP resolution
$provinceStringObtained from IP resolution
$cityStringObtained from IP resolution
$network_typeStringNetwork type
$browserStringBrowser name
$browser_versionStringBrowser version
$latest_utm_sourcestringThe latest source of the last paid advertising campaign, taken from the last source value with a value.
$latest_utm_mediumstringThe latest medium of the last paid advertising campaign, taken from the last medium value with a value.
$latest_utm_termstringThe latest term of the last paid advertising campaign, taken from the last term value with a value.
$latest_utm_contentstringThe latest content of the last paid advertising campaign, taken from the last content value with a value.
$latest_utm_campaignstringThe latest campaign name of the last paid advertising campaign, taken from the last campaign name value with a value.
$latest_sceneStringLatest launch scene value

3. Predefined user attribute

Attribute nameAttribute typeDefault display nameDescriptionRemark
$first_visit_timeTimeFirst visit timeAssigned when a new user visits the mini program for the first timeBecause the settings of these attributes are only applied to new users when they first visit the mini program, new users are generally identified by anonymous ID to track their behaviors. If the association between login ID and anonymous ID fails, the login ID will not have values from these attributes.
$utm_sourceStringFirst ad campaign source

These user attributes are collected only when using the mini program channel tracking and when new users access the program through channels with utm parameters for the first time. Existing users will not have these attributes even if they access the program through channels. For marking new and existing users, please refer to this document: New User and First-Day First-Time Marking

$utm_mediumStringFirst Advertising Campaign Medium
$utm_termStringFirst Advertising Campaign Keyword
$utm_contentStringFirst Advertising Campaign Content
$utm_campaignStringFirst Advertising Campaign Name