Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #450220

    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.

    #450240

    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>WSB Analytics</p></noscript>
    <?php
    }
    add_action('wp_footer', 'add_custom_code');

    Regards,
    Yigit

    #453211

    thanks Yigit!!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘custom javascript on every page – using child theme’ is closed to new replies.