0

The SEO company keeps bugging me to put the Analytics code in the <head> section because they say:

"...the code isn't in the <head> section, I am unable to install webmaster tools, which is essential to us tracking keywords for the campaign. Could you please move the analytics code to the <head> section or paste the following code in the section?"

How do I do that? Or is there a place in the Admin where this can be added and it would allow the SEO people to install the Webmaster tools?

NEW INFO: Magento 2.1.0

Update: I tried putting the code into:

Content -> Design -> Configuration -> Open your theme for edit -> HTML Head

but it didn't include the Google Analytics code before the end HEAD tag so I put it at the bottom of:

/public_html/app/design/frontend/myTHEME/MYtheme/my_THEME/templates/html/head.phtml

Is this a good solution?

1

Try going to this part of the admin:

System->Configuration->Design->Head

and see if you can insert what you need in there

  • that's perfect and it works great in the 1.x.x version - I'm trying to put it into Magento 2.1.0 – Allysin Oct 21 '16 at 20:07
1

Magento provides a system configuration called Miscellaneous scripts. You can assign your analytics JS code into it and it will add this JS code into head section.

Follow below steps to assign JS to Miscellaneous scripts.

  1. Login to the admin panel
  2. go to system>configuration
  3. Click on the Design section on the left
  4. Open the HTML Header group
  5. And look for a text box labled “Miscellaneous scripts”

I hope it will help.

  • that's perfect and it works great in the 1.x.x version - I'm trying to put it into Magento 2.1.0 – Allysin Oct 21 '16 at 20:07
0

In Magento 2.1 Miscellaneous scripts configuration is rendering before the body closing tag and it's no longer in Stores -> Configuration section.

If you need to place the script into <head> tag you can place it in Scripts and Style Sheets section

Content -> Design -> Configuration -> Open your theme for edit -> HTML Head

This will be included before head closing tag in page HTML.

  • I did that on all levels - website, store and storefront and deleted ALL CACHE and re-indexed via SSH but the code has not been inserted before the closing /head tag. And the SEO people insist: So the head section of the website ends on line 50 in the source code. Currently the Google Analytics tracking code is in place at around line 121. I will need it to be pasted somewhere before /head and before line 50 in the source code. – Allysin Oct 21 '16 at 22:43

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.