Commit f78ec134 authored by zjz1994's avatar zjz1994

Merge branch '埋点' of http://gitlab2.dui88.com/wanghongyuan/xiaoxiaole into 草地+埋点

parents 09a7234a 45b95f97
...@@ -11,6 +11,13 @@ ...@@ -11,6 +11,13 @@
<meta name="screen-orientation" content="portrait" /> <meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" /> <meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" /> <meta name="360-fullscreen" content="true" />
<!-- <input type="hidden" id="resourceType" value="inapp">
<meta content="inapp" name="siteid">
<input type="hidden" id="pagename" value="pgcate=10004;tag=100060/null;pgtitle=赚钱消消乐">
<meta content="true" name="autoclick">
<meta content="aNVgWFAAaA" name="pageid">
<script src="libs/sa_simple.js"></script> -->
<style> <style>
html, html,
body { body {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
<e:Image source="nsad1_png" horizontalCenter="0" y="35"/> <e:Image source="nsad1_png" horizontalCenter="0" y="35"/>
<e:Image id="img" y="44" width="560" height="160" source="{data.img}" anchorOffsetY="0" horizontalCenter="0.5"/> <e:Image id="img" y="44" width="560" height="160" source="{data.img}" anchorOffsetY="0" horizontalCenter="0.5"/>
<e:Image id="adsmask" source="adsmask_png" horizontalCenter="0.5" y="45" width="560" height="160"/> <e:Image id="adsmask" source="adsmask_png" horizontalCenter="0.5" y="45" width="560" height="160"/>
<e:Image source="nsad2_png" horizontalCenter="-7.5"/> <e:Image source="nsad2_png" horizontalCenter="-7.5" touchEnabled="false"/>
</e:Skin> </e:Skin>
\ No newline at end of file
...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager"; import { DataManager } from "../../libs/tw/manager/DataManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait"; import wait from "../../libs/new_tc/wait";
import { snpmAdStatic } from "../statics/snpmAdStatic";
export default class AdSmallComp extends ComponentBase { export default class AdSmallComp extends ComponentBase {
...@@ -21,12 +22,14 @@ export default class AdSmallComp extends ComponentBase { ...@@ -21,12 +22,14 @@ export default class AdSmallComp extends ComponentBase {
if (popupAdvert == null) if (popupAdvert == null)
popupAdvert = { enable: false, advertList: [] } popupAdvert = { enable: false, advertList: [] }
this.visible = popupAdvert.enable; this.visible = popupAdvert.enable;
if (popupAdvert.enable) { if (popupAdvert.enable) {
result = popupAdvert.advertList; result = popupAdvert.advertList;
if (Array.isArray(popupAdvert.advertList)) { if (Array.isArray(popupAdvert.advertList)) {
const index = Math.floor(popupAdvert.advertList.length * Math.random()); const index = Math.floor(popupAdvert.advertList.length * Math.random());
result = popupAdvert.advertList[index]; result = popupAdvert.advertList[index];
} }
snpmAdStatic.snpmAdReport("show","bottom",result);
this.data.img = result.img; this.data.img = result.img;
} }
}); });
...@@ -34,8 +37,10 @@ export default class AdSmallComp extends ComponentBase { ...@@ -34,8 +37,10 @@ export default class AdSmallComp extends ComponentBase {
this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (data.logid) if (data.logid)
NetManager.ins.clickLog(getlogItem(data.logid)); NetManager.ins.clickLog(getlogItem(data.logid));
snpmAdStatic.snpmAdReport("click","bottom",result);
wait(50).then(() => { wait(50).then(() => {
if (result.url != 0) window.location.href = result.url; // if (result.url != 0) window.location.href = result.url;
}); });
}, this); }, this);
} }
......
...@@ -38,6 +38,7 @@ import getSignBtn from "./getSignBtn"; ...@@ -38,6 +38,7 @@ import getSignBtn from "./getSignBtn";
import getAdBtn from "./getAdBtn"; import getAdBtn from "./getAdBtn";
import getInviteBtn from "./getInviteBtn"; import getInviteBtn from "./getInviteBtn";
import { play2, play1 } from "../panels/help/svgaTool"; import { play2, play1 } from "../panels/help/svgaTool";
import { snpmAdStatic } from "../statics/snpmAdStatic";
let doHelpFlag = false; let doHelpFlag = false;
// let doScratchHelpFlag = false; // let doScratchHelpFlag = false;
...@@ -732,11 +733,14 @@ export default class MapScene extends Scene { ...@@ -732,11 +733,14 @@ export default class MapScene extends Scene {
const index = Math.floor(mapAdvert.advertList.length * Math.random()); const index = Math.floor(mapAdvert.advertList.length * Math.random());
result = mapAdvert.advertList[index]; result = mapAdvert.advertList[index];
} }
snpmAdStatic.snpmAdReport("show","icon",result);
this['adBtn'].source = result.img; this['adBtn'].source = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(32)); // NetManager.ins.clickLog(getlogItem(32));
if(result.url!=0) snpmAdStatic.snpmAdReport("click","icon",result);
window.location.href = result.url; if(result.url!=0){
// window.location.href = result.url;
}
}, this); }, this);
} }
} }
......
...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager"; import { DataManager } from "../../libs/tw/manager/DataManager";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait"; import wait from "../../libs/new_tc/wait";
import { snpmAdStatic } from "../statics/snpmAdStatic";
export default class ADPanel extends Panel { export default class ADPanel extends Panel {
start(data) { start(data) {
...@@ -21,10 +22,12 @@ export default class ADPanel extends Panel { ...@@ -21,10 +22,12 @@ export default class ADPanel extends Panel {
const index = Math.floor(noticeAdvert.advertList.length * Math.random()); const index = Math.floor(noticeAdvert.advertList.length * Math.random());
result = noticeAdvert.advertList[index]; result = noticeAdvert.advertList[index];
} }
snpmAdStatic.snpmAdReport("show","dialog",result);
this.data.img = result.img; this.data.img = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(result.url=='0')return; if(result.url=='0')return;
snpmAdStatic.snpmAdReport("click","dialog",result);
NetManager.ins.clickLog(getlogItem(25)); NetManager.ins.clickLog(getlogItem(25));
wait(100).then(()=>{ wait(100).then(()=>{
window.location.href = result.url; window.location.href = result.url;
......
export class snpmAdStatic{
/**
* 苏宁广告上报
* @param type show曝光,click点击
* @param from 来源1.icon首页小图标,2.dialog大弹窗广告,3.bottom部分弹窗下挂载的
*/
static snpmAdReport(type:string,from:string,adata:object){
var params = {};
console.log("准备上报",type,from,JSON.stringify(adata));
switch(from){
case 'icon':
params['eleid']='bingoIndexAd';
params['saData']={
pageid:"aNVgWFAAaA",
modid:"bingoMapIndex",
eleid:"bingoIndexAd",
targeturl:adata['apsClickUrl']||''
}
params['sapmodid'] = 'bingoMapIndex';
params['targeturl']=adata['apsClickUrl']||'';
break;
case 'dialog':
params['eleid']='bingoGroupAd';
params['saData']={
pageid:"aNVgWFAAaA",
modid:"bingoDialog",
eleid:"bingoGroupAd",
targeturl:adata['apsClickUrl']||''
}
params['sapmodid'] = 'bingoDialog';
params['targeturl']=adata['apsClickUrl']||'';
break;
case 'bottom':
params['eleid']='bingoLevelAd';
params['saData']={
pageid:"aNVgWFAAaA",
modid:"bingoDialog",
eleid:"bingoLevelAd",
targeturl:adata['apsClickUrl']||''
}
params['sapmodid'] = 'bingoDialog';
params['targeturl']=adata['apsClickUrl']||'';
break;
default:
console.error("未定义snpm上报");
break;
}
if(params){
if(type=="show"){
this.showAdReport(params);
}else if(type=="click"){
this.clickAdReport(params);
}
}
}
/**
* 苏宁曝光上报,snpm
* @param params
*/
static showAdReport(params){
try{
console.log("曝光上报",JSON.stringify(params));
let elem = document.createElement('div')
params.saData.eleid = params.eleid;
    elem.setAttribute('sa-data', JSON.stringify(params.saData))
    // 新增广告埋点
    if (params.targeturl) {
      elem.setAttribute('href', params.targeturl)
    }
elem.setAttribute("sap-modid",params.sapmodid);
elem.setAttribute("eleid",params.eleid);
    if (window['SAUP'] && window['SAUP'].sendLogData) {
//expoManual
//exposure
     window['SAUP'].sendLogData("expoManual", elem);
// window['SAUP'].sendLogData("expoManual", {
// tag:elem,
// sapmodid:params.sapmodid,
// event_name:'exposure',
// targeturl:params.targeturl,
// pageid:params.saData.pageid,
// modid:params.saData.modid,
// eleid:params.saData.eleid,
// });
    }
}catch(e){
}
}
/**
* 苏宁点击上报,snpm
* @param params
*/
static clickAdReport(params){
try{
console.log('点击上报',JSON.stringify(params));
if(params.targeturl&&params.targeturl.length){
window['$'].ajax({
type:'get',
url:params.targeturl,
dataType:'json',
success:res=>{
},
error:err=>{
}
})
}
let elem = document.createElement('div');
elem.setAttribute('sa-data',JSON.stringify(params.saData));
//广告埋点
if(params.targeturl){
elem.setAttribute('href',params.targeturl);
//异步发送请求
let img = new Image();
img.src = params.targeturl;
}
if (window['SAUP'] && window['SAUP'].sendLogData) {
console.log("广告点击上报",params.saData.pageid);
//click
//comclick
window['SAUP'].sendLogData('click',{
tag:elem,
sapmodid:params.sapmodid,
targeturl:params.targeturl,
event_name:'comclick',
pageid:params.saData.pageid,
modid:params.saData.modid,
eleid:params.saData.eleid,
})
}
elem.setAttribute('sa-data', '{}');
}catch(e){
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment