Commit 1aa8ea03 authored by zjz1994's avatar zjz1994

snpm上报

parent 93e9c6fb
......@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait";
import { snpmAdStatic } from "../statics/snpmAdStatic";
export default class AdSmallComp extends ComponentBase {
......@@ -21,12 +22,14 @@ export default class AdSmallComp extends ComponentBase {
if (popupAdvert == null)
popupAdvert = { enable: false, advertList: [] }
this.visible = popupAdvert.enable;
if (popupAdvert.enable) {
result = popupAdvert.advertList;
if (Array.isArray(popupAdvert.advertList)) {
const index = Math.floor(popupAdvert.advertList.length * Math.random());
result = popupAdvert.advertList[index];
}
snpmAdStatic.snpmAdReport("show","bottom",result);
this.data.img = result.img;
}
});
......@@ -34,6 +37,8 @@ export default class AdSmallComp extends ComponentBase {
this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (data.logid)
NetManager.ins.clickLog(getlogItem(data.logid));
snpmAdStatic.snpmAdReport("click","bottom",result);
wait(50).then(() => {
if (result.url != 0) window.location.href = result.url;
});
......
......@@ -38,6 +38,7 @@ import getSignBtn from "./getSignBtn";
import getAdBtn from "./getAdBtn";
import getInviteBtn from "./getInviteBtn";
import { play2, play1 } from "../panels/help/svgaTool";
import { snpmAdStatic } from "../statics/snpmAdStatic";
let doHelpFlag = false;
// let doScratchHelpFlag = false;
......@@ -732,11 +733,14 @@ export default class MapScene extends Scene {
const index = Math.floor(mapAdvert.advertList.length * Math.random());
result = mapAdvert.advertList[index];
}
snpmAdStatic.snpmAdReport("show","icon",result);
this['adBtn'].source = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
NetManager.ins.clickLog(getlogItem(32));
if(result.url!=0)
snpmAdStatic.snpmAdReport("click","icon",result);
if(result.url!=0){
window.location.href = result.url;
}
}, this);
}
}
......
......@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { getlogItem } from "../Main";
import wait from "../../libs/new_tc/wait";
import { snpmAdStatic } from "../statics/snpmAdStatic";
export default class ADPanel extends Panel {
start(data) {
......@@ -21,10 +22,12 @@ export default class ADPanel extends Panel {
const index = Math.floor(noticeAdvert.advertList.length * Math.random());
result = noticeAdvert.advertList[index];
}
snpmAdStatic.snpmAdReport("show","dialog",result);
this.data.img = result.img;
this['adBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(result.url=='0')return;
snpmAdStatic.snpmAdReport("click","dialog",result);
NetManager.ins.clickLog(getlogItem(25));
wait(100).then(()=>{
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){
}
/**
* 苏宁曝光上报,snpm
* @param params
*/
static showAdReport(params){
try{
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("exposure", elem);
    }
}catch(e){
}
}
/**
* 苏宁点击上报,snpm
* @param params
*/
static clickAdReport(params){
try{
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) {
//click
//comclick
window['SAUP'].sendLogData('comclick',{
tag:elem,
sapmodid:params.sapmodid,
eleid:params.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