I'm very new to ExpressionEngine and I couldn't find a similar question already posed. I have some javascript that I need to add to every single page. What's the best way to accomplish this?


Is there instructions somewhere on how to install Google Tag Manager?


3 Answers 3


I believe each EE site uses any template that shares same data. Like., Head, Header, Footer etc. You can select any of those templates and put your JS code inside it.

To find out, You can edit any template to see structure of the site. If You will find {embed="..."} tag that shares head, header etc. you can paste your code in that file that is embeding.

In my case, I create Snippets (In EE3/4 in called as template partials.) to store head, header, footer, footer JS. If your site uses those snippets, you can move your code there too.


Do you have access to edit the site templates? You'll need to do so.

Are your templates managed as files? If so, you'll want to open up your editor and make your changes directly on the file.

Depending on how your templates are organized it is likely you'll want to add your JavaScript snippet to either a "layout" template or to a template that functions as an "include" (embedded template). Just search for the </body> tag and you'll know which template it's in. If your templates are set up this way (with a globally embedded template that has the closing body tag, or a layout template), then adding the JavaScript snippet there should add it to your entire site.


You just need to create embed into Comman template group and include that created embed in any template where you want it.

Create js-embed.html in your Comman template group and paste your javascript code into it.

And, you just include that created embed by {embed="comman_template_group/.js-embed"} in the template you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.