How to add website tracking code.
In WordPress go to Customize > Footer > Settings
Enter your code and click the Save & Publish button.
Option #1: Add the tracking code to a text footer widget.
If you choose to display the footer widgets, you can add a text widget with any content you want, and at the bottom of that content, copy and paste the tracking code in the text widget. This will add the tracking code to the footer of you website that appears on every page.
Option #2 – Paste the tracking code into the footer.php file. ( Not recommended )
This is not suggested because when you get a new theme update, this code will be overwritten.
But you can do this by going to “Editor” under “Appearance” on the sidebar. On the right side of the page click “Footer (footer.php)”. Scroll down in the window of the code, and paste your tracking code right before you see the </body></html> code.