0

I'm just getting started with the Magento CMS and I am not sure that it can do what I need right know. I need to include some custom javascript in every pages of my site :

  • One line of js code in <head>
  • At the end of the body a remote script like : <script src="https://..." type="text/javascript"></script> followed by some inline js.

I have seen other answer on this topic but nothing would really fit this particular requirement. Is it even possible to do something like this with magento ? (I am using Magento 2.1.5)

Thanks guys

1 Answer 1

0

I managed to solve this myself. I was looking for something complex but this is in fact pretty easy.

  1. Access the admin dashboard and authentificate
  2. In content -> Design -> Configuration, Select the store you want to add your script into and select Edit
  3. For the head part, just past the code into HTML Head -> Scripts and Style Sheets
  4. For the body part just past the code into Footer -> Miscalleneous HTML
  5. Click Save Configuration
  6. In System -> Tools -> Cache Management. Select all items and Submit a Refresh
  7. Finally browse to your website and open the developer console to be sure that your js is loaded.

Your Answer

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

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