Where do I install the GA4 header tag (on each page), since there does not seem to be a “header” tag in GRAV?
@stephanckdt, Template partials/base.html.twig
is used by Quark as the base template for all inheriting templates like default.html.twig
, blog.html.twig
, etc.
I presume other themes follow the same logic.
If you inject the GA4 script in template partials/base.html.twig
directly below the <head>
element, all pages will contain the GA4 script.
Thanks a lot, Pam. I’m non-techie. So where is the partials/base.html.twig on my GRAV backend to be found so I can insert the code? I’d appreciate step-by step.
@stephanckdt, In most themes, if not all, template base.html.twig can be found in folder /user/themes/yourtheme/templates/partials.
Be aware when updating a theme which you have downloaded, that you may loose your changes when a new version of the theme gets released. To prevent the loss of your changes, you should first create a child theme that inherits from your downloaded theme and make changes only in the newly created child theme. See Inheriting using the CLI.
Alternatively, you could use a plugin that loads the Analytics script, but unfortunately, none supports GA4 at the moment.