The mtracker web universal automatic instrumentation solution supports PC and mobile H5 pages. It automatically reports instrumentation data based on tag properties, covering page view, click, and exposure events on mobile H5 pages.
mtracker supports three instrumentation types. Before you configure universal instrumentation, review the table below to understand how each type works and which require additional setup:
|
Instrumentation type |
What it captures |
Trigger |
|
A page open event each time any page loads |
Automatic — no code required |
|
|
Button and link clicks within a page |
Tag-based (automatic) or manual JavaScript (JS) call |
|
|
Content segments that become visible in the viewport |
Manual JS call |
Page view instrumentation
After you import mtracker, a page view event is automatically recorded each time a page loads. No additional code is required.
Click instrumentation
Click instrumentation records clicks on buttons and links within a page. Use tag-based instrumentation (automatic) or a manual JS trigger.
Tag-based instrumentation
Add the data-seed attribute to any HTML tag. mtracker listens for click events and automatically logs clicks on tags that carry this attribute.
-
Basic tracking — add
data-seedwith a unique seed name:<div data-seed="seedname"></div> Business code — add
data-biztypeto include abizTypevalue in the log alongside theseed:
<div data-seed="seedname" data-biztype="xxx"></div>
Extension properties — add attributes prefixed with data-mtr- to attach extra metadata logged with the seed. The data-mtr- prefix is stripped in the log output. The following example logs the seed as seedname with the extension properties extra1=111 and extra2=222:
HTML markup:
<div data-seed="seedname" data-mtr-extra1="111" data-mtr-extra2="222"></div>
Logged extension properties: extra1=111^extra2=222
Manual trigger
Use the JS click method when tag-based instrumentation cannot cover your scenario — for example, when a single tag must log different events depending on context.
Tracker.click(eventId, options)
Parameters
|
Parameter |
Type |
Example |
Description |
|
eventId |
String |
clickseedname |
The event ID. |
|
options |
Object |
- |
Configuration options. Contains |
|
options.bizType |
String |
Pay |
The business code. |
|
options.ext |
Object |
|
The extension parameters. |
Code example
Tracker.click('clickseedname', { bizType: 'Pay', ext: { productId: 'xxx' } });
Exposure instrumentation
Exposure instrumentation records the exposure of content segments within a page — for example, when an image carousel is displayed.
Call Tracker.expo() to log an exposure event:
Tracker.expo(eventId, options)
Parameters
|
Parameter |
Type |
Example |
Description |
|
eventId |
String |
exposeedname |
The event ID. |
|
options |
Object |
- |
Configuration options. Contains |
|
options.bizType |
String |
Pay |
The business code. |
|
options.ext |
Object |
|
The extension parameters. |
Code example
Tracker.expo('exposeedname', { bizType: 'Pay', ext: { productId: 'xxx' } });