react-growsumojs
v2.0.0
Published
Small component to implement GrowSumoJS into your react application
Downloads
104
Readme
react-growsumojs
Small component to implement GrowSumoJS into your react application
GrowSumoJS is javascript snippet that reads browser cookies and sends signup information back to your GrowSumo account.
Installation
npm i react-growsumojs
or
yarn add react-growsumojs
Use/Example
Initialize the growsumojs into the page you gonna use it, passing your appkey.
import React, { Component } from 'react';
import GrowSumo from 'react-growsumojs';
import logo from './logo.svg';
import './App.css';
class App extends Component {
componentDidMount() {
GrowSumo.initialize(your_growsumo_appkey);
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
export default App;
react-growsumojs exposes other 2 methods
setUserInfo: Used to set the user data, this method expect 1 object with 3 properties.
1 - name: Customer Name
2 - email: Customer Email
3 - customerKey: Is a unique string that identifies each customer you send to growsumo.
const customerData = {
name: 'Joe',
email: '[email protected]',
customerKey: '123'
};
GrowSumo.setUserInfo(customerData);
createSignup: Used to call the growsumojs createSignup. This method accepts a callback function which will be executed when the request is completed.
GrowSumo.createSignup();
or
GrowSumo.createSignup(() => {
console.log('create signup was called successfully')
});