|
|
@@ -1,4 +1,5 @@
|
|
|
import {fb_trackEvent,fb_trackPageView,fb_setPixelID} from "./FacebookPixel";
|
|
|
+import {gg_setTagID,gtrack} from "./GoogleAnalytics";
|
|
|
import {kwai_setPixelID,kwai_trackEvent} from "./KwaiPixel";
|
|
|
|
|
|
export const initTrackAll = (pf_type,pf_id,ex_id) => {
|
|
|
@@ -6,6 +7,9 @@ export const initTrackAll = (pf_type,pf_id,ex_id) => {
|
|
|
fb_setPixelID(pf_id,ex_id)
|
|
|
}else if(pf_type==="kw"){
|
|
|
kwai_setPixelID(pf_id,ex_id)
|
|
|
+ }else if(pf_type==="gg"){
|
|
|
+ pf_id=pf_id.split("|")
|
|
|
+ gg_setTagID(pf_id[0],pf_id[1]);
|
|
|
}
|
|
|
window.addEventListener('installready', function(){
|
|
|
//Show your own installation UI
|
|
|
@@ -13,6 +17,8 @@ export const initTrackAll = (pf_type,pf_id,ex_id) => {
|
|
|
trackEvent("InstallPWA")
|
|
|
}else if(pf_type==="kw"){
|
|
|
trackEvent("download")
|
|
|
+ }else if(pf_type==="gg"){
|
|
|
+ trackEvent("file_download")
|
|
|
}
|
|
|
|
|
|
});
|
|
|
@@ -25,6 +31,23 @@ export const trackPageView = () => {
|
|
|
};
|
|
|
|
|
|
export const trackEvent = (eventName, params) => {
|
|
|
+ if (window.gtag&&global.pf&&global.pf.type==='gg') {
|
|
|
+ if(eventName==="pay"){
|
|
|
+ let data=params;
|
|
|
+ if(data.first) {
|
|
|
+ if (!!data.isd0) {
|
|
|
+ gtrack("d0", {currency:'BRL',value:data.golds,transaction_id:data.order_sn})
|
|
|
+
|
|
|
+ }
|
|
|
+ gtrack("d1", {currency:'BRL',value:data.golds,transaction_id:data.order_sn})
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ gtrack('purchase', {currency:'BRL',value:data.golds,transaction_id:data.order_sn});
|
|
|
+ }else{
|
|
|
+ gtrack(eventName, params);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (window.fbq&&global.pf&&global.pf.type==='fb') {
|
|
|
if(eventName==="pay"){
|
|
|
let data=params;
|