1.0.6 • Published 5 years ago

react-with-scripts v1.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

react-with-scripts

< Back to Project WebCube

NPM Version

Nodei

Add third party script tags, JS SDK and tracking code without modifying any HTML code

npm install --save react-with-scripts

Examples

Get Started

import React, { Component } from 'react';
import withScripts, { googleAnalytics } from 'react-with-scripts';

@withScripts(
  googleAnalytics({
    googleAnalyticsTrackingId: 'UA-XXXXX-XX',
  }),
)
class App extends Component {
  render() {
    return (
      <AppRoot>
        {/* ... */}
      </AppRoot>
    )
  }
}

or

import React from 'react';
import withScripts, { googleAnalytics } from 'react-with-scripts';

export const App = withScripts(
  googleAnalytics({
    googleAnalyticsTrackingId: 'UA-XXXXX-XX',
  }),
)((props) => {
  return (
    <AppRoot>
      {/* ... */}
    </AppRoot>
  )
});

Options

googleAnalytics()

  • googleAnalyticsTrackingId
  • googleOptimizeId
  • googleAnalyticsInit (optional)
    • type - Function
    • params - ga

baiduTongji()

  • baiduTongjiId
  • baiduTongjiScript (optional)

wechatSdk()

  • wechatScript
    • type - String
  • wechatSignatureApi
    • type - String
  • wechatDebug
    • type - Boolean
    • wx.config({ debug: true,
  • wechatApiList
    • type - Array
    • wx.config({ jsApiList: [],

growingIo()

  • growingIoAccountId

zhugeIo()

  • zhugeIoAppKey