/** * Show Tracking Scripts */ function calibrefx_show_tracking_scripts() { global $post; $analytic_id = calibrefx_get_option('analytic_id'); $google_tagmanager_code = calibrefx_get_option('google_tagmanager_code'); $facebook_tracking_code = calibrefx_get_option('facebook_tracking_code'); if (!empty($analytic_id)) { echo "\n<script type='text/javascript'>\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', '{$analytic_id}']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement( 'script' ); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ( 'https:' == document.location.protocol ? 'https://ssl' : 'http://www' ) + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName( 'script' )[0]; s.parentNode.insertBefore(ga, s);\n })();\n</script>\n "; } if (!empty($google_tagmanager_code)) { echo stripslashes(cap_attr($google_tagmanager_code)); } if (!empty($facebook_tracking_code)) { echo stripslashes(cap_attr($facebook_tracking_code)); } }
/** * Echo the header scripts, defined in Theme Settings. */ function calibrefx_header_scripts() { echo apply_filters('calibrefx_header_scripts', cap_attr(calibrefx_get_option('header_scripts'))); }