react-with-scripts
v1.0.6
Published
Add third party script tags, JS SDK and tracking code without modifying any HTML code
Downloads
27
Maintainers
Readme
react-with-scripts
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