Jump to content

How to add a code inside the body element?

Recommended Posts

  • Replies 17
  • Created
  • Last Reply
  • 4 months later...

I couldn’t get the tag manager to work when it was in the header. The code seemed to load, and I didn’t get an errors in my console when I stuck the GTM code in the header (or footer), but when I used the Tag Assistant (Google Chrome extension) it gave me an error that said my tag was detected, but it wasn’t in the correct place (which is right after the opening <body>).

These instructions worked for me: How to inject the Google Tag Manager script into a Squarespace template with jQuery – hope that helps!

Link to comment
  • 3 months later...
  • 4 weeks later...
  • 3 months later...

Following these instructions inserts the code into the Head of the page not the Body.

Can you please advise how you get it in the body and not the head of the page.

Thanks.

Link to comment

Following these instructions inserts the code into the Head of the page not the Body.

Can you please advise how you get it in the body and not the head of the page.

Thanks.

Link to comment

Hi Chris, Your instructions on your page result in the code being injected in the header before the body. Is it possible to get the code immediately after the body? If so how?Thanks :)

Link to comment

Hello Colinc. In my instructions, I use - jQuery('body').prepend - to add the script. This will prepend the script (or elements, etc) as the first child of the

element. It will not add anything to the . I'm unclear why you suggest it would. If I'm misunderstanding something, please let me know. Thanks!
Link to comment
  • 8 months later...
  • 10 months later...

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.