本文整理汇总了TypeScript中react-ga.ga函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ga函数的具体用法?TypeScript ga怎么用?TypeScript ga使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ga函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: init
import * as _ from 'lodash';
import * as ReactGA from 'react-ga';
import { configs } from 'ts/utils/configs';
import { utils } from 'ts/utils/utils';
import * as Web3 from 'web3';
export const analytics = {
init() {
ReactGA.initialize(configs.GOOGLE_ANALYTICS_ID);
},
logEvent(category: string, action: string, label: string, value?: any) {
ReactGA.event({
category,
action,
label,
value,
});
},
async logProviderAsync(web3IfExists: Web3) {
await utils.onPageLoadAsync();
const providerType = !_.isUndefined(web3IfExists)
? utils.getProviderType(web3IfExists.currentProvider)
: 'NONE';
ReactGA.ga('set', 'dimension1', providerType);
},
};
示例2: it
it("Able to make ga calls", () => {
ga.ga();
});
示例3: it
it("Able to make returned ga calls with any arguments", () => {
ga.ga()("create", "UA-65432-1", "auto", "trackerName");
});