Here we will review the different methods to include the ReferralHero external JavaScript library in ReactJS.
PLEASE NOTE:
In each of these example methods, we will be installing the ReferralHero Global Tracking Code and the Dashboard Widget. Replace the <div> to install a different widget, etc.
MFxxxxxxxxxxx or RH_MFxxxxxxxxxxx (if running multiple campaigns) is just a placeholder and must be replaced with your campaign UUID.
Steps to create the application:
Step 1: Create a React application using the following command inside your terminal or command prompt:
npx create-react-app name_of_the_app
Step 2: After creating the react application move to the directory as per your app name using the following command:
cd name_of_the_app
Project Structure
Now modify the default App.js file inside your source code directory according to any of the following approaches.
Approach 1: Using react-helmet Package
Installation: Open the terminal inside your ReactJS project folder and write the following code to install react-helmet Package.
Approach 3: Using tag in index.html of public directory
We can add the scripts directly in the ReactJS using the index.html file in the public directory. Go to the public directory and add the script using the script tag inside the head tag.