Tagged: enqueue
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
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://" : "http://");
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
Brilliant, thanks Yigit!