Tagged: 

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

    Hi there,
    I need to add some tracking code to my footer, instead of just placing it in the footer.php of my child theme I’m guessing placing it in my child themes functions.php might be the best way to go.
    Any tips on this?
    The code itself is provided in the private content area.
    Thanks,
    Jason

    #378360

    Hi Jason!

    Please add following code to Fuctions.php file in Appearance > Editor

    function add_custom_script(){
    ?>
    <script type="text/javascript">
    var cdJsHost = (("https:" == document.location.protocol) ? "https://&quot; : "http://&quot;);
    document.write(unescape("%3Cscript src='" + cdJsHost + "analytics-eu.clickdimensions.com/ts.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    
    <script type="text/javascript">
    var cdAnalytics = new clickdimensions.Analytics('analytics-eu.clickdimensions.com');
    cdAnalytics.setAccountKey('aFkPIGWT8MkSDbFqaKRmq5');
    cdAnalytics.setDomain('cdc.org.nz');
    cdAnalytics.trackPage();
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Cheers!
    Yigit

    #379258

    Brilliant, thanks Yigit!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Enqueue JS in footer’ is closed to new replies.