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


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

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


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

示例1: it

    it("Able to initailize react-ga object", () => {
        const options: ga.InitializeOptions = {
            debug: true,
        };

        ga.initialize("UA-65432-1", options);
    });
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:7,代码来源:react-ga-tests.ts

示例2:

addons.register('storybook/google-analytics', api => {
  ReactGA.initialize(window.STORYBOOK_GA_ID);

  api.on(STORY_CHANGED, () => {
    const { url } = api.getUrlState();
    ReactGA.pageview(url);
  });
  api.on(STORY_ERRORED, ({ description }: { description: string }) => {
    ReactGA.exception({
      description,
      fatal: true,
    });
  });
  api.on(STORY_MISSING, ({ id }: { id: string }) => {
    ReactGA.exception({
      description: `attempted to render ${id}, but it is missing`,
      fatal: false,
    });
  });
});
开发者ID:chinmaymoharir,项目名称:storybook,代码行数:20,代码来源:register.ts

示例3:

import * as ReactGA from 'react-ga';

import {SETTINGS} from 'core/config/settings';

if (SETTINGS.analytics.ga) {
  ReactGA.initialize(SETTINGS.analytics.ga, {});
}
开发者ID:jcwest,项目名称:deck,代码行数:7,代码来源:react.ga.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: pageView

import { useContext, useEffect, useState } from 'react';
import * as GA from 'react-ga';

import {
  dataContext,
  langContext,
  preferenceContext,
  uiContext
} from '../contexts';
import { getNewPath, isDateInRange } from '../contexts/uiContext';
import * as api from '../utils/api';
import { isProduction, version } from './consts';
import { useSelectedArea } from './hooks';

GA.initialize('UA-85003235-1', {
  debug: !isProduction
});

function pageView(location: Location) {
  const pathname = location.pathname + location.search;
  GA.set({ page: pathname, 'App Version': version });
  GA.pageview(pathname);
}

export default (location: any, history: any) => {
  const { lang } = useContext(langContext);
  const preferences = useContext(preferenceContext);
  const ui = useContext(uiContext);
  const data = useContext(dataContext);
  const selectedArea = useSelectedArea();
开发者ID:Kanttiinit,项目名称:kanttiinit-web,代码行数:30,代码来源:useSideEffects.ts


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