当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript react-ga.event函数代码示例

本文整理汇总了TypeScript中react-ga.event函数的典型用法代码示例。如果您正苦于以下问题:TypeScript event函数的具体用法?TypeScript event怎么用?TypeScript event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了event函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: evalExpression

export function evalExpression(gist: string, scriptId: string, expr: string) {
    if (!expr)
        return;

    const request = new EvaluateExpression();
    request.scriptId = scriptId;
    request.expression = expr;
    request.includeJson = true;

    ReactGA.event({ category: 'preview', action: 'Evaluate Expression', label: gist + ": " + expr.substring(0, 50) });

    client.post(request)
        .then(r => {
            if (r.result.errors && r.result.errors.length > 0) {
                r.result.errors.forEach(x => {
                    store.dispatch({ type: 'CONSOLE_LOG', logs: [{ msg: x.info, cls: "error" }] });
                });
            } else {
                store.dispatch({ type: 'EXPRESSION_LOAD', expressionResult: r.result });
            }
        })
        .catch(e => {
            var status = e.responseStatus || e; //both have schema `{ message }`
            store.dispatch({ type: 'CONSOLE_LOG', logs: [statusToError(status)] });
        });
};
开发者ID:ServiceStack,项目名称:Gistlyn,代码行数:26,代码来源:utils.ts

示例2: useEffect

 useEffect(() => {
   if (selectedArea) {
     GA.event({
       action: 'selected area',
       category: 'User',
       label: selectedArea.name,
       value: selectedArea.id
     });
   }
 }, [selectedArea]);
开发者ID:Kanttiinit,项目名称:kanttiinit-web,代码行数:10,代码来源:useSideEffects.ts

示例3: it

    it("Able to make event calls", () => {
        ga.initialize("UA-65432-1");

        const options: ga.EventArgs = {
            category: "Test",
            action: "CI",
            label: "Running Jasmine tests for react-ga typscript library",
            value: 4,
            nonInteraction: true,
        };

        ga.event(options);
    });
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:13,代码来源:react-ga-tests.ts

示例4: 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);
    },
};
开发者ID:ewingrj,项目名称:0x-monorepo,代码行数:26,代码来源:analytics.ts

示例5: event

export const sendEvent = (eventPayload: AnalyticsEvent) => {
  event(eventPayload);
}
开发者ID:displague,项目名称:manager,代码行数:3,代码来源:analytics.ts


注:本文中的react-ga.event函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。