I am new to React and am looking for the React equivalent of this JQuery approach to including analytics throughout my application.
Typically I would:
Include the 3rd party library on the html pages. Easy enough to put on the index.html page but I don't know if that is best practice.
<script src="http://path/to/script/utag.js" />Then I can interact with the library as long as it has loaded, which I can verify using JQuery window.load. This script will run fine on a plain html page, but I am trying to find the equivalent best practice way of doing this in my react app. I don't want to introduce jquery and currently my React container will tell me that utag is not defined if I try referencing
utagin a function.<script> $(window).load(function() { utag.link({ "event_name" : "locale_select", "language" : utag_data.language, "currency" : utag_data.currency } ); }); </script>
I'm new to React so any help would be great. I know that my project is not using webpack, it's using react-scripts and was started using the create-react-app utility.