Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Analytics kills Dashboard with Blank page


r-a-y
Keymaster

@r-a-y

On the author’s plugin page, he says the plugin requires the BP bar, but it really doesn’t; it doesn’t hook into anything.

Here’s the proper way to have written the plugin:

function bp_ga_analytics() {
echo '<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-5834099-9");
pageTracker._trackPageview();
} catch(err) {}</script>';
}
add_action('bp_after_footer', 'bp_ga_analytics');

You can also use Andrea’s tutorial as well, the difference between Andrea’s and mine is I’m using the bp_after_footer action, and not the wp_footer action.

bp_after_footer shouldn’t hook into the admin dashboard as well, so this should be safe.

Skip to toolbar