Back to Posts

Fix for the Disqus' Facebook Connect caused messy statistics issue

Ali Kuru in disqus, howto, Me, php, Web, wordpress

I’ve recently started using Disqus for the handling of this blogs’ comments. Service has really nice features, including integration with Facebook Connect, which unfortunately seem to mess with your statistics if you are using StatCounter or Google Analytics (I’m using both).

There is a solution posted on the Disqus blog and I’ve got a tip for you if you are using WordPress, which will allow you to include the given xd_receiver.html on your blog only when necessary, to reduce the front page size.

If you wrap the given code on the Disqus blog with the WordPress conditional tagis_single(), mentioned xd_receiver.html (and the javascript that its calling) will only included in your post pages, where the comment form should appear. See the code below;

<?php if (is_single()) { ?>
<script type="text/javascript">
    var facebookXdReceiverPath='';
<?php } ?>

If you are allowing your visitors to comment on your WordPress pages too, you might want to change the is_single() with is_singular() ;)

Update: Disqus has launched an update and Facebook Connect caused messy statistics issue seem to reoccur. Here is another workaround.

PhD in Microbiology, head of digital at Kapital Media. Interested in geekery, gadgets and ever-evolving web.

Read Next

Prezi early review: Will change your view about presentations