- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having trouble when trying to put a java script on my footer.
I've just bought a marketing automation plataform and to integrate it with magento 2.x I need to put this script.
Anyone has done this before? Thank you in advance
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @andré_scaff
I have put the javascript on shared path and flush the cache so while loading the website it alerts "Hi".
See attached screen shot for your reference:
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
alert("Hi");
});
</script>
This is the example which I put and got alert. Please try in this way, hope it will work for you as well.
if issue solved,Click Kudos & Accept as Solution
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to add a java script in the footer? Magento 2.X
Hi @andré_scaff
Go to admin and follow this path:
Content -> Design -> Configuration -> Here you will see the listing of theme which is enabled for your store.
Click on edit and you will see one section named as "Footer". In Footer, you will find one field named as " Miscellaneous HTML". Put your java script here, it will added to your footer.
Flush the cache after doing the same.
if issue solved,Click Kudos & Accept as Solution
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to add a java script in the footer? Magento 2.X
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to add a java script in the footer? Magento 2.X
I will test it, and if it works I will do it \o
Thank you so much for the help!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to add a java script in the footer? Magento 2.X
I've just tested it and it didn't work.
It didn't add the javascript to the footer, actually nothing happened.
Do you know any other way of doing it?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @andré_scaff
I have put the javascript on shared path and flush the cache so while loading the website it alerts "Hi".
See attached screen shot for your reference:
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
alert("Hi");
});
</script>
This is the example which I put and got alert. Please try in this way, hope it will work for you as well.
if issue solved,Click Kudos & Accept as Solution
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: How to add a java script in the footer? Magento 2.X
I was able to do it using google tag manager.
I'm going to try again using this, I think I forgot to flush the cash, that's why It didn't work actually.
Thank you so much for your help!