-
Install Node.js
-
Install dependencies:
npm install jctrans-track-report
orpnpm install jctrans-track-report
-
Add code
First, you need to add the following code in the main.js file
You have to known your project's appId and reportApi
Additional, add them in the options
import trackReport from 'jctrans-track-report'
Vue.use(trackReport, {
router,
store,
options: { appId, reportApi },
})
Then, you may have route page tracking and auto track page view
how to use directive in pages.
<div
v-track-report="{
eventCode: 'Event.FOOTER.CN.CLICK',
extensions: {
lang: 'zh-CN',
},
reportApi: request,
}"
>
<div/>
<div
v-c-report="{
eventCode: 'Event.FOOTER.CN.CLICK',
extensions: {
lang: 'zh-CN',
}
}"
>
<div/>
// you can use reportUrl to define yourself reportUrl
<div
v-c-report="{
eventCode: 'Event.FOOTER.CN.CLICK',
extensions: {
lang: 'zh-CN',
},
reportUrl: 'track/xxx/send'
}"
>
<div/>