Adding Script above the header

Hello,

I need to add the following script above my header, so that the push-notification displays on all pages on my site:

How should I do this? I tried added the following code in the functions.php of my child theme but nothing happens.

add_action( 'wp_head', 'add_head_script', 999 );

function add_head_script(){
?>
    <!-- Push SE Ranking on-page SEO Audit -->
    <script async data-widget-page-audit-id='145164' src='https://online.seranking.com/skin/js/widget.js'></script>
<?php
}

Thanks,
Antoine

Hi There,

Thanks for writing in! Your method used above is correct. Also you can use a plugin like this (https://wordpress.org/plugins/insert-headers-and-footers/).

If that doesn’t help, provide us with the URL to your site.

If you’re using any caching plugin, make sure to purge your server cache before testing.

Thanks!

Thanks for your response.

I’ll prefer to avoid having to use a plugin as it seems to be possible without. Could you please have a look and let me know what I did wrong?

URL: https://e-marketingmix.fr/

As you can see there is no push-notification, which is supposed to appear at the top of the website.

Hi,

I checked your site’s source code and can’t see the script being added in the <head></head>

Did you remove the code in your child theme’s functions.php file ?

Can you provide us the entire code that’s in your functions.php file.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.