forked from apxtri/apxtrib
57 lines
2.3 KiB
JavaScript
57 lines
2.3 KiB
JavaScript
|
/**
|
||
|
* Tracking management:
|
||
|
*
|
||
|
* without header:
|
||
|
* https://dns.xx/trk/pathtofile?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&src=btnregister&version=1&lg=fr
|
||
|
*
|
||
|
* with header
|
||
|
* https://dns.xx/trk/pathtofile?src=btnregister&version=1
|
||
|
*
|
||
|
* where pathtofile is a ressource accessible from https://dns.xx/pathtofile
|
||
|
*
|
||
|
* We get :
|
||
|
* alias: if athenticated from header else anonymous
|
||
|
* uuid: a uuid v4 générate the first time a web page is open on a browser
|
||
|
* src: source action that trig this get
|
||
|
* version: can be an int, date or any version of the src
|
||
|
* tm: optionnal is a timestamp of action when it is not immediate (offline app)
|
||
|
*
|
||
|
* html usage to track a loading page or email when a picture is load
|
||
|
* using apxwebapp in /src/ we got:
|
||
|
* <img src="static/img/photo.jpg" data-trksrckey="loadpage" data-version="1">
|
||
|
*
|
||
|
* using html + apx.js (or at least with header {xalias,xuuid,xlang})
|
||
|
* <img lazysrc="trk/static/img/photo.jpg data-trksrckey="loadpage" data-version="1">
|
||
|
*
|
||
|
*
|
||
|
* in js action:
|
||
|
* <button></button> or
|
||
|
* <a data-trksrc="linktoblabla" href='https:..'
|
||
|
* onclick="apx.trackvisit("btnaction",1);actionfct();">
|
||
|
* </a>
|
||
|
* will hit an eventlistener
|
||
|
* axios.get("https://dns.xx/trk/cdn/empty.json?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&src=btnregister&version=1");
|
||
|
*
|
||
|
*
|
||
|
* or if no js available (example:email or pdf document)
|
||
|
* <img src="https://dns.xx/trk/static/img/photo.jpg?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&srckey=loadpage&version=1" will hit a tracker
|
||
|
*
|
||
|
* <a href="https://dns.xx/trk/redirect?alias=anonymous&uuid=1b506f71-1bff-416c-9057-cb8b86296f60&srckey=loadpage&version=1&url=http://..." will hit a tracker then redirect to url></a> *
|
||
|
*
|
||
|
*
|
||
|
* if you use apx.js :
|
||
|
* in html add in <button>, <img>, <a> tag data-trksrc="srckey"
|
||
|
* <img src="https://dns.xx/static/img/photo.jpg" data-trkversion="1" data-trksrckey="registerform">
|
||
|
* <button data-trksrc="https://dns.xx/static/img/photo.jpg" data-trkversion="1" data-trksrckey="registerform">
|
||
|
* in js call apx.track(srckey);
|
||
|
*
|
||
|
* Tracking log into tribe/logs/nginx/tribe_appname.trk.log
|
||
|
* Src have to be manage in tribe/api/models/lg/src_en.json
|
||
|
* {"srckey":{
|
||
|
* "app":"presentation|app|apptest",
|
||
|
* "title":"",
|
||
|
* "description":""
|
||
|
* }
|
||
|
* }
|
||
|
*
|
||
|
*/
|