mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 17:08:41 +00:00
重命名小助手使用到的统计函数
This commit is contained in:
parent
9e2b61c859
commit
f679dc8293
@ -14,7 +14,7 @@ import { GA_EventName } from "../../ga/type";
|
|||||||
import Banner from "./banner.vue";
|
import Banner from "./banner.vue";
|
||||||
import { emitter, Msg } from "./const";
|
import { emitter, Msg } from "./const";
|
||||||
import { AdItem, getAdData } from "./loader";
|
import { AdItem, getAdData } from "./loader";
|
||||||
import { ga } from "./util";
|
import { sendGaEvent } from "./util";
|
||||||
const { CCButton } = ccui.components;
|
const { CCButton } = ccui.components;
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ad",
|
name: "ad",
|
||||||
@ -37,7 +37,7 @@ export default defineComponent({
|
|||||||
ads.value = data.data.filter((item) => item.valid);
|
ads.value = data.data.filter((item) => item.valid);
|
||||||
console.log("get ads ", toRaw(ads.value));
|
console.log("get ads ", toRaw(ads.value));
|
||||||
|
|
||||||
ga(GA_EventName.ShowAd);
|
sendGaEvent(GA_EventName.ShowAd);
|
||||||
});
|
});
|
||||||
onUnmounted(() => {});
|
onUnmounted(() => {});
|
||||||
function testBanner() {
|
function testBanner() {
|
||||||
|
@ -26,7 +26,7 @@ import Ad from "./ad.vue";
|
|||||||
import Banner from "./banner.vue";
|
import Banner from "./banner.vue";
|
||||||
import Memory from "./memory.vue";
|
import Memory from "./memory.vue";
|
||||||
import { appStore } from "./store";
|
import { appStore } from "./store";
|
||||||
import { ga } from "./util";
|
import { sendGaEvent } from "./util";
|
||||||
declare const cc: any;
|
declare const cc: any;
|
||||||
const { CCDialog, CCMenu } = ccui.components;
|
const { CCDialog, CCMenu } = ccui.components;
|
||||||
interface ListItem {
|
interface ListItem {
|
||||||
@ -58,7 +58,7 @@ export default defineComponent({
|
|||||||
const { config } = storeToRefs(appStore());
|
const { config } = storeToRefs(appStore());
|
||||||
function doInspector() {
|
function doInspector() {
|
||||||
unregisterPickShortKey();
|
unregisterPickShortKey();
|
||||||
ga(GA_EventName.GameInspector);
|
sendGaEvent(GA_EventName.GameInspector);
|
||||||
if (config.value.autoHide) {
|
if (config.value.autoHide) {
|
||||||
showBtns.value = false;
|
showBtns.value = false;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ export default defineComponent({
|
|||||||
width: 310,
|
width: 310,
|
||||||
height: 500,
|
height: 500,
|
||||||
closeCB: () => {
|
closeCB: () => {
|
||||||
ga(GA_EventName.CloseAd);
|
sendGaEvent(GA_EventName.CloseAd);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -91,7 +91,7 @@ export default defineComponent({
|
|||||||
{
|
{
|
||||||
icon: "icon_do_play",
|
icon: "icon_do_play",
|
||||||
click: (event: MouseEvent, item: ListItem) => {
|
click: (event: MouseEvent, item: ListItem) => {
|
||||||
ga(GA_EventName.GamePlayer);
|
sendGaEvent(GA_EventName.GamePlayer);
|
||||||
if (typeof cc !== "undefined") {
|
if (typeof cc !== "undefined") {
|
||||||
cc.game.resume();
|
cc.game.resume();
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ export default defineComponent({
|
|||||||
visible: true,
|
visible: true,
|
||||||
txt: "game pause",
|
txt: "game pause",
|
||||||
click: () => {
|
click: () => {
|
||||||
ga(GA_EventName.GamePause);
|
sendGaEvent(GA_EventName.GamePause);
|
||||||
if (typeof cc !== "undefined") {
|
if (typeof cc !== "undefined") {
|
||||||
cc.game.pause();
|
cc.game.pause();
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ export default defineComponent({
|
|||||||
visible: true,
|
visible: true,
|
||||||
txt: "game step",
|
txt: "game step",
|
||||||
click: () => {
|
click: () => {
|
||||||
ga(GA_EventName.GameStep);
|
sendGaEvent(GA_EventName.GameStep);
|
||||||
if (typeof cc !== "undefined") {
|
if (typeof cc !== "undefined") {
|
||||||
cc.game.step();
|
cc.game.step();
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ export default defineComponent({
|
|||||||
enabled: inspectTarget.enabled,
|
enabled: inspectTarget.enabled,
|
||||||
selected: inspectTarget.isContainInspectType(item.type),
|
selected: inspectTarget.isContainInspectType(item.type),
|
||||||
callback: (menu: IUiMenuItem) => {
|
callback: (menu: IUiMenuItem) => {
|
||||||
ga(GA_EventName.MouseMenu, menu.name);
|
sendGaEvent(GA_EventName.MouseMenu, menu.name);
|
||||||
if (menu.selected) {
|
if (menu.selected) {
|
||||||
inspectTarget.removeInspectType(item.type);
|
inspectTarget.removeInspectType(item.type);
|
||||||
} else {
|
} else {
|
||||||
@ -159,7 +159,7 @@ export default defineComponent({
|
|||||||
callback: (menu: IUiMenuItem) => {
|
callback: (menu: IUiMenuItem) => {
|
||||||
const event = new CustomEvent(DocumentEvent.InspectorClear);
|
const event = new CustomEvent(DocumentEvent.InspectorClear);
|
||||||
document.dispatchEvent(event);
|
document.dispatchEvent(event);
|
||||||
ga(GA_EventName.MouseMenu, menu.name);
|
sendGaEvent(GA_EventName.MouseMenu, menu.name);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -168,7 +168,7 @@ export default defineComponent({
|
|||||||
callback: (menu: IUiMenuItem) => {
|
callback: (menu: IUiMenuItem) => {
|
||||||
config.value.pickTop = !config.value.pickTop;
|
config.value.pickTop = !config.value.pickTop;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
ga(GA_EventName.MouseMenu, menu.name);
|
sendGaEvent(GA_EventName.MouseMenu, menu.name);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ type: ccui.menu.MenuType.Separator },
|
{ type: ccui.menu.MenuType.Separator },
|
||||||
@ -176,7 +176,7 @@ export default defineComponent({
|
|||||||
name: "Filter Enabled",
|
name: "Filter Enabled",
|
||||||
selected: inspectTarget.enabled,
|
selected: inspectTarget.enabled,
|
||||||
callback: (menu: IUiMenuItem) => {
|
callback: (menu: IUiMenuItem) => {
|
||||||
ga(GA_EventName.MouseMenu, menu.name);
|
sendGaEvent(GA_EventName.MouseMenu, menu.name);
|
||||||
inspectTarget.enabled = !inspectTarget.enabled;
|
inspectTarget.enabled = !inspectTarget.enabled;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -277,7 +277,7 @@ export default defineComponent({
|
|||||||
callback: (item) => {
|
callback: (item) => {
|
||||||
config.value.autoHide = !config.value.autoHide;
|
config.value.autoHide = !config.value.autoHide;
|
||||||
appStore().save();
|
appStore().save();
|
||||||
ga(GA_EventName.MouseMenu, item.name);
|
sendGaEvent(GA_EventName.MouseMenu, item.name);
|
||||||
if (!config.value.autoHide) {
|
if (!config.value.autoHide) {
|
||||||
clearTimeout(autoHideTimer);
|
clearTimeout(autoHideTimer);
|
||||||
showBtns.value = true;
|
showBtns.value = true;
|
||||||
|
@ -12,7 +12,7 @@ import { defineComponent, onMounted, onUnmounted, PropType, ref, toRaw } from "v
|
|||||||
import { GA_EventName } from "../../ga/type";
|
import { GA_EventName } from "../../ga/type";
|
||||||
import { emitter, Msg } from "./const";
|
import { emitter, Msg } from "./const";
|
||||||
import { AdItem } from "./loader";
|
import { AdItem } from "./loader";
|
||||||
import { ga } from "./util";
|
import { sendGaEvent } from "./util";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "banner",
|
name: "banner",
|
||||||
props: {
|
props: {
|
||||||
@ -47,7 +47,7 @@ export default defineComponent({
|
|||||||
const url = toRaw(props.data.store);
|
const url = toRaw(props.data.store);
|
||||||
if (url) {
|
if (url) {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
ga(GA_EventName.ClickPluginLink, url);
|
sendGaEvent(GA_EventName.ClickPluginLink, url);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { GA_EventName } from "../../ga/type";
|
import { GA_EventName } from "../../ga/type";
|
||||||
import { DocumentEvent, GoogleAnalyticsData } from "../const";
|
import { DocumentEvent, GoogleAnalyticsData } from "../const";
|
||||||
|
|
||||||
export function ga(event: GA_EventName, params: string = "") {
|
export function sendGaEvent(event: GA_EventName, params: string = "") {
|
||||||
const detail = { event, params } as GoogleAnalyticsData;
|
const detail = { event, params } as GoogleAnalyticsData;
|
||||||
const e = new CustomEvent(DocumentEvent.GoogleAnalytics, { detail });
|
const e = new CustomEvent(DocumentEvent.GoogleAnalytics, { detail });
|
||||||
document.dispatchEvent(e);
|
document.dispatchEvent(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user