1

How do I add the html code to the head of my website in Craft CMS?

Do I need to install a plugin, or is there somewhere I can access the code?

2

Craft makes no assumptions on how your site should be built so it's impossible for us to say exactly where to put the pixel code.

You would add the code to whichever template you needed it in. This depends entirely on how your site is put together.

Oftentimes the <head> portion will be within your main _layout file but that is not necessarily always the case. This file can also be anywhere within your templates directory.

For Craft 2, look in your /craft/templates directory For Craft 3, look in your /templates directory

1

If you're using SEOmatic for Craft3 it has a setting to add facebook pixel and various other tracking scripts.

SEOmatic github

2
  • Thanks Steven, if I don't have that plugin, is there any way to do it for free? – Jordan Hayes Nov 16 '18 at 0:25
  • If you don't use that plugin you can use the answer foamcow gave and manually insert it in your template code. – Steven Vandemoortele Nov 16 '18 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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