hello
I'm wondering how can I insert a script from Google Adsense into the <head></head> section on Backdrop CMS?
Is there a module that can do this?
Thank you very much for your answer.
hello
I'm wondering how can I insert a script from Google Adsense into the <head></head> section on Backdrop CMS?
Is there a module that can do this?
Thank you very much for your answer.
Hi @suriyan2538
What's your technical skill level? There's a function called backdrop_add_js()
which you can add to an existing preprocess function within template.php file within your theme as the easiest way. Or you can also create a small custom module with the script url hardcoded that will add it to the header. What you'll need is something like:
function custom_module_name_preprocess_page(&$variables) { backdrop_add_js('http://example.com/example.js', 'external'); }
The default behaviour is to put this in the header.
There are a couple of D7 modules that might make this easier but they haven't been ported yet.
Hello @yorkshirepudding
First of all, I really appreciate your answer.
I am a newbie in this field. I have no knowledge of any themes.
When I was using Drupal 7 I was able to do this with the Header and Footer Scripts module.
https://www.drupal.org/project/header_and_footer_scripts
Thank you for your comment.
I've added a port request on your behalf to https://github.com/backdrop-ops/contrib/issues/729
If you're on github you can subscribe there but if not, I've cross referenced to this post so someone should update this post. It looks fairly straightforward, but unfortunately I don't have time to do this at present.
Hi @suriyan2538
What's your technical skill level? There's a function called
backdrop_add_js()
which you can add to an existing preprocess function within template.php file within your theme as the easiest way. Or you can also create a small custom module with the script url hardcoded that will add it to the header. What you'll need is something like:The default behaviour is to put this in the header.
There are a couple of D7 modules that might make this easier but they haven't been ported yet.