Copy Google tag from:
Google Analytics > Admin > Property > Data Streams > View tag instructions > Install manually
and paste into your website’s <head>
section.
For Grav:
/[your_domain]/user/themes/[your_theme]/templates/partials/base.html.twig
For Flarum use GUI admin:
Admin > Appearance > Custom Header
For OpenCart:
/catalog/view/theme/[your_theme]/template/common/header.tpl