I am using Newspaper 8.5.1. I have to add the following code immediately before the closing </head> tag in the document source:
<script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: “ca-pub-4830297679832206”,
enable_page_level_ads: true
});
</script>
Please advise how I can do it.
Thanks n Regards…… Renu Bakshi
Thank you for your suggestion.
(i) In the analytics section I already have added google analytics code. So can I add here more than one code.
(ii) I want to add a google adsense page level code. Will it work if added in analytics section.
(iii) Is there any other way to add code just before closing head tag.
Thanks…
Hello,
1. Yes, you can add more than one code as the field simply adds the code in the head tag of header.php.
2. Hello, the page level ads should work as well in the analytics section. We have not officially tested it but if it does not work , you should follow this implementation process: https://forum.tagdiv.com/topic/page-level-ads-adsense/
3. There are 2 ways. either the analytics section or directly in heaader.php in the main the folder.
Thank you!
Hello Bogdan,
Really your reply is great help and has cleared my many doubts (I am not a techy!). I will place this code in analytics section and I hope it should work.
Now a question, it may look ridiculous to you :). If I place the code in analytics section, how it works? Does it get placed in heaader.php in the main the folder?
Thanks for your help!
Regards…
Hello,
Yes. That is the main functionality of the field. Here is an example:
theme panel: https://www.screencast.com/t/pBPpEWpW
head section: https://www.screencast.com/t/fJc9XoZgiPT
Thank you!
Hello:
Thanks Bogdan.
So what I place in Analytics section is injected before the closing </head> tag.
And what I add in the Custom HTML code and Custom Javascript code are not injected into the theme’s core files. The code from there is simply rendered on the frontend.
Kindly just explain a little more, as I am not a tech., but very keen to know.
Thanks and it’s a great help from you.
Regards…..
If thew code is added properly, it will not render on the front-end but it depends on what that code is. If it;s a js code, then you can use the analytics section but you need to use the script tag: https://www.w3schools.com/tags/tag_script.asp
Thanks.