To install Google Analytics in WordPress without a plugin, you can paste the tracking code to either the footer.php or header.php file of your theme. You can paste your Google Analytics tracking code to these files because they are loaded every time a user visits a post or page of your website.
If you use Elementor Pro and use its Theme Builder feature to create a custom header and custom footer for your website, Google Analytics will stop working since when you create a custom header and custom footer with Elementor Pro, they (the custom footer and custom header) will replace the default header and footer of your active theme. You need to re-install Google Analytics to have it works again.
How to install Google Analytics in Elementor without a plugin
There are several plugins that you can use to install Google Analytics on your Elementor-based website. If you prefer to install Google Analytics without a plugin, there is also a way to do so.
First, go to Templates -> Theme Builder. On the Theme Builder page, click the Footer tab. Hover your mouse over the footer template you use on your website and click Edit with Elementor.
Add the HTML widget by dragging it to your custom footer on the canvas area. You can place it anywhere within the footer.
Paste your Google Analytics tracking code to the HTML Code field on the left panel and click the UPDATE button.
You have successfully reinstalled your Google Analytics on your Elementor-based website without a plugin. If you find a problem to find the tracking code on your previous installation, you can read this article to learn more.