Followers, What Followers?

Now I don't want people to think that this blog is just about code for fixing problems with Blogger but... for this post I'll be fixing a problem with Blogger!

I don't tend to read my own blog that often, which means I don't spend much time looking at it. So it wasn't until I started investigating how to disable Blogger's forced lightbox viewer that I spotted I had a problem with the followers gadget on some of my blogs. Developing my original fix to that problem involved reloading my blog over and over again as I tried different things. Sometimes the followers gadget appeared and sometimes it didn't. There didn't seem to be any pattern but there was definitely a problem.

Given that a lot of the gadgets you find on blogs are JavaScript based the first thing I checked was the JavaScript console (I use Firebug in Firefox for most of my web development work) which showed the following two errors whenever the followers gadget failed to appear; window.googleapisv0 is undefined and google.friendconnect.container is undefined.

Given that the problem was intermittent I made a guess that this was some form of race condition. Most browsers will try and load at least two files required to render a web page in parallel. This means that sometimes files download and become available to the browser in a different order. Usually this doesn't matter but my gut feeling was that this was causing the problem. A quick look at the list of JavaScript files associated with my blog showed that there were quite a few related to the followers widget and that were all loaded at roughly the same time. I experimented by manually adding each of these scripts to the head section of the HTML template until I eventually found a solution.

Strangely it wasn't a script associated directly with the followers gadget that solved the problem, but rather a script for the +1 button. This did, however, explain why I was only seeing the problem on my blogs which included the sharing buttons below each post. So if you find that your followers gadget sometimes doesn't appear then it might be worth trying the following fix.

You need to edit the HTML version of your template (you might be able to do this via a HTML/JavaScript gadget as well but I've had less success) so in the old style Blogger dashboard go to the design page or in the new style go to the template page and then click to edit the HTML version of your template. Now directly after <head> insert the following:

<script src='https://apis.google.com/js/plusone.js' type='text/javascript'/>

This fixed the problem for me, and I've suggested the fix in a couple of threads on the Blogger forum and it seems to have worked there as well, so hopefully it should stop your followers gadget disappearing for good!

25 comments:

  1. Haha ! I followed a link direct to this blog from a thread started by shrek (I think you know who I mean, the most annoying unhelpful person ever to invade a help forum)...but having read this I think we may have spoken there too.

    ps Bit disappointed - am in UK and addicted to coffee, have always said that if my laptop could make coffee it would be perfect. The real reason I came here is because the title led me to believe I might find the programme to make it do just that.

    ReplyDelete
  2. I'm getting hooked. I hate not knowing things. Thanks.

    ReplyDelete
  3. I had no idea you could have a race condition in JS, I thought it was a procedural language and that everything would be executed in sequence? I've seen this behaviour before on occassion, but always assume the browser's implementation of JS was poor.

    ReplyDelete
  4. Ian, I guess technically you are right. The problem here is that it seems Blogger have split code that interacts between different scripts. So while you can't get a race condition within a script, the speed difference in downloading the scripts causes the behaviour to change in the same way two threads might in the classic race condition scenario.

    ReplyDelete
  5. dirtycowgirl, yes we've spoken in the Blogger forums. I think when I commented in the thread you were involved in I'd already posted something similar in atleast one other thread. So I decided to do this post as something I could easily refer to if I needed it again -- it would be much easier if you could link to a specific comment on the Blogger forums but I haven't figure out how, and once a thread gets long linking to the thread gets a bit silly.

    You are right though, a laptop that could also make coffee would be absolutely perfect!

    ReplyDelete
  6. I think in the future if I see people there with the same problem I'll just link them to this post, if that's ok with you ?

    Worst case scenario you get people posting their problems here...but you may well get more followers.
    Up to you ? - I'll check back here.

    ReplyDelete
  7. Yes feel free to send people to this post. That way if I find any improvements or change the fix in anyway they'll always get the most up to date answer.

    ReplyDelete
  8. I feel like crying right now, I am so relieved and having this fixed. I can't believe you fixed my blog, I owe you a coffee! THANK YOU!

    ReplyDelete
  9. Hi Bethany, glad it worked for you. And if you ever find yourself in Sheffield, UK then feel free to buy me a coffee :)

    ReplyDelete
  10. Yay! I've been googling this to no avail, then I checked out some Blogger help threads, then found this, and it worked! Thanks so much.

    ReplyDelete
  11. thank you! hopefully this works for people...I have been having problems with it showing up! You were so helpful!!!!

    colorissue.blogspot.com

    ReplyDelete
  12. Thank you very much for posting about this issue, it has been affecting my blog for months! So far this code is working!

    ReplyDelete
  13. Thank you again. It's been eating at me for so long! It's nice to see the little heads ALL the time.

    ReplyDelete
  14. Darn, this fix didn't work for me. My Followers are missing when the page is viewed in Explorer 7, maybe other browsers, as well. They do show up in Firefox but not in Netscape 7.2. or Opera.

    ReplyDelete
  15. It looks as if Google may have changed the javascript they are using, as I'm seeing a new error when I view your blog. I'll try and find the time to have another poke around to see if I can figure out what is going on.

    ReplyDelete
  16. Hi. I followed the trail about no followers, and have found you. I think that my problem might be a little different though. I can see my followers most of the time, but they would intermittently disappear and then show up again. I added your snippet, and I was able to see them. But the other issue is that I have people who follow me, but they aren't listed (and they aren't anonymous either). And then other people who want to follow me have trouble. I think it's on their end, but now I don't know. Any suggestions? Thanks in advance.

    ReplyDelete
  17. Hi Kari, I think most of the problems with the followers widget (when it shows up) is on Google's end. I believe I currently have 18 followers (that is what my dashboard always says) but the widget (and the page I get from following the link on my dashboard) ranges between 15 and 18 followers and seems to be arbitrary as to which don't show up. It would be nice if Google would actually fix these problems but for now I think we will just have to live with it the way it is.

    ReplyDelete
  18. Hey Mark ... I followed your directions and it did not fix anything. It changed my Blog, took my header away and now I cannot even sign in to do more blogs or that that HTML edit out. Please advise ASAP so I can get back into my Blog. Audrey Z. at Timeless Treasures.

    ReplyDelete
  19. Hi Audrey, it looks as if your blog is back to normal now. I'm guessing that if adding the "fix" messed up your header then you probably inserted it after the </head> tag rather than before it. As to why you couldn't log in to blogger I've no idea, although I'd assume that blogger was just having one of it's regular periods of refusing to work properly.

    ReplyDelete
  20. I tried this and it did not work for me. Strangely, I see the same problem on your blg. I see the followers label but nothing under it. What do you think the problem is?

    ReplyDelete
  21. I always say, "Let your fingers to the walking" -- dealing with this issue now. Lets see if I can kick it. Thanks for the post! :)

    ReplyDelete
  22. Okay @ Crystal ... after I read your comment I scrolled up ... and there it was ... the MISSING 'Followers' list! What now?!?

    ReplyDelete
  23. Clearly it's not just a script issue to be dealt with within the template of one's blog...

    ReplyDelete
  24. Hi Aishah,

    Sorry it doesn't seem to be working for you. As I said it only seems to lesson the occasions on which the problem appears. Also the underlying problem is related to the speed of the viewers internet connection. Currently it seems to be working (for me) on all my blogs and the two of yours which have the followers gadget. I'm guessing that your connection to Blogger's servers is slow today which is causing the problem to appear for you, even when the "fix" has been applied.

    ReplyDelete