Tagged: child, header, header.php, javascript, script
Hi,
I need to install the following code inside every page, but also need it protected against future theme updates. should I create a child theme header.php file or something like that?
here is the code:
<script src="//hello.staticstuff.net/w/WSBAnalytics.js" type="text/javascript"></script>
<script type="text/javascript">try{ WSBAnalytics.init(100836693); }catch(e){}</script>
<noscript><p><img alt="WSB Analytics" width="1" height="1" src="//win.staticstuff.net/100836693ns.gif" /></p></noscript>
not sure if this will work in the Add Google tracking code box or what I should do?
thanks in advance for your help.
Hey MindSpark!
Please add following code to Functions.php file of your child theme
function add_custom_code(){
?>
<script src="//hello.staticstuff.net/w/WSBAnalytics.js" type="text/javascript"></script>
<script type="text/javascript">try{ WSBAnalytics.init(100836693); }catch(e){}</script>
<noscript><p></p></noscript>
<?php
}
add_action('wp_footer', 'add_custom_code');
Regards,
Yigit
thanks Yigit!!!