123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- const attribution = require("AdjustAttribution");
- const Global = require("Global");
- const AdjustEvent = require("AdjustEvent");
- const BaseDefine = require("BaseDefine");
- function initAttribution() {
- cc.vv.reflection.getAdjustAttribution();
- }
- class Adjust {
- constructor() {
- this.attribution = attribution;
- // initAttribution();
- }
- getSpreadID() {
- let clickLabel = attribution.getClickLabel();
- let spreadID = "0";
- if (clickLabel) { // 使用后保存,保证安装后只使用一次
- spreadID = clickLabel.split("-")[0];
- }
- console.log("AdjustAttribution:: getSpreadID:" + spreadID);
- return spreadID;
- }
-
- getNetwork() {
- return attribution.getNetwork();
- }
- getChannelID() {
- let campaign = attribution.getCampaign();
- let clickLabel = attribution.getClickLabel();
- let channelID = cc.vv.config.Channel;
- if (campaign) {
- // 匹配 * 符号以后的数字,不包括 * 符号,且不包括被匹配数字后从非数字字符下标起的任意字符,包括数字
- channelID = campaign.match(/\*\d+/)[0].slice(1) || channelID;
- } else if (clickLabel) {
- channelID = clickLabel.split("-")[1] || channelID;
- }
- console.log("AdjustAttribution:: getChannelID:" + channelID);
- return channelID;
- }
- getCampaign() {
- return attribution.getCampaign();
- }
- getAdjustCam() {
- let campaign = attribution.getCampaign();
- let channelID = 0;
- if (campaign) {
- // 匹配 * 符号以后的数字,不包括 * 符号,且不包括被匹配数字后从非数字字符下标起的任意字符,包括数字
- let CA = campaign.match(/\*\d+/);
- if(CA && CA[0]) {
- channelID = CA[0].slice(1) || channelID;
- }
- // channelID = campaign.match(/\*\d+/)[0].slice(1) || channelID;
- }
- console.log("AdjustAttribution:: getAdjustCam:" + channelID);
- return channelID;
- }
- getAdID() {
- let adid = attribution.getAdid() || cc.vv.reflection.getDeviceUUID() || Global.getUUID();
- console.log("AdjustAttribution:: getAdID:" + adid);
- return adid;
- }
- getOnlyAdID() {
- return attribution.getAdid();
- }
- isEmpty() {
- if (BaseDefine.GAME_PLATFORM == BaseDefine.WEB_H5_PLATFORM) {
- return false;
- }
- return (cc.adjust) ? false : true;
- }
- static setTrackLinkID(packageID) {
- if (packageID == "com.teenpatti.queen") {
- cc.vv.config.Channel = 0;
- cc.vv.config.ChannelIdx = 0;
- BaseDefine.ADJUST_DATA.AGENT = "rp1867g";
- }
- else {
- cc.vv.config.Channel = 0;
- cc.vv.config.ChannelIdx = 0;
- BaseDefine.ADJUST_DATA.AGENT = "rp1867g";
- }
- Global.print("AppStart::initChannelInfo: " + BaseDefine.ADJUST_DATA.AGENT);
- }
- static setEventID(packageID) {
- if (packageID == "com.teempatti.championplayer") {
- AdjustEvent.config["Buy Gold Success"] = "nct9zd";
- AdjustEvent.config["Buy Gold Success Test"] = "fbhv45";
- AdjustEvent.config.Registration = "rj6t83";
- AdjustEvent.config.Registration_Test = "zdzryh";
- }
- else if (packageID == "com.teempatti.victory") {
- AdjustEvent.config["Buy Gold Success"] = "rp9epc";
- AdjustEvent.config.Registration = "ne97pz";
- }
- else {
- }
- Global.print("Adjust::setEventID: " + JSON.stringify(AdjustEvent.config));
- }
- }
- module.exports = Adjust;
|