1. Event sending before page redirection
Scenario Description
When the user clicks the tag www.xxxx.com the href attribute on the web page, the triggered click event may not be sent because the page is immediately redirected. If you want to ensure that data is sent in this scenario, report the click event before the page is redirected.
Example:
// Click the link.
function targetLinkCLK(url) {
aplus_queue.push({
action: 'aplus.record',
arguments:['track_alink_clk', 'CLK', {
param1: "xxxx",
param2: "xxxx",
}],
});
window.location.href = url;
};In extreme cases, if the event cannot be sent normally, you can perform a page delay jump. The sample code is as follows:
// Click the link.
function targetLinkCLK(url) {
// Delay page redirection and reserve the amount of time for the SDK to send the page.
setTimeout(function(){
window.location.href = url;
}, 500);
aplus_queue.push({
action: 'aplus.record',
arguments:[ 'track_alink_clk', 'CLK', {
param1: "xxxx",
param2: "xxxx",
}],
});
}2 How to bury H5 in App?
For more information about H5 tracking in Android, see:
Android App H5 Bridge Operations Documentation
For more information about H5 tracking in iOS, see:
3 How to bury H5 in small programs?
For more information about H5 tracking points in mini programs, see:
H5 embedded tracking operation document in mini programs
4 H5 full embedding point
Full buried point function | functional meaning | Operational documentation |
Page Events | When a page is loaded and the onload function in the lifecycle is triggered, the page browsing event is automatically reported. Its default event parameters are: url: page URL with parameters ref_url: document.referrer page_name: The page URL does not include parameters. page_title: document.title | |
Click event | Specifies the label type. When a label of this type is clicked, the control click event is automatically reported. Its default event parameters are when the event fires: url: page URL with parameters ref_url: document.referrer page_name: The page URL does not include parameters. page_title: document.title and control ID, control type, control filter, control location, control content, control name, control style name | |
Specifies the element class. When the element of this class is clicked, the control click event is automatically reported. Its default event parameters are when the event fires: url: page URL with parameters ref_url: document.referrer page_name: The page URL does not include parameters. page_title: document.title | ||
Specifies the label type. When a label of this type is exposed (appears in the visible area), the control exposure event is automatically reported. Its default event parameters are when the event fires: url: page URL with parameters ref_url: document.referrer page_name: The page URL does not include parameters. page_title: document.title |
5. Customize the expiration time of the cookie written by the SDK
As privacy compliance policies tend to be stricter, some regions require that the default expiration time of cookies cannot exceed one year. Therefore, the SDK adds a custom expiration time for the SDK to write cookies, in days.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="qt-cookie-expires" content="180">
....js
</head>
<body></body>
</html>As shown in the code, if you want to customize the expiration time of the cookie written by the SDK, you must add a meta tag named qt-cookie-expires.
Detailed Description:
Parameter | Meaning | Documentation |
qt-cookie-expires | sdk custom cookie expiration time | Represents the number of days to expire based on the start of the current access time. Numeric minimum: 1 Digital maximum: 20*365 The default expiration time is 365 days. |