diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Optimized Google +1 Button Embedding Code

Last weeks, Google launched “+1 button” for webmaster to embedd on their web site/blog(s) to help visitor share their content across the Internet. diTii.com convered the official announcement here, and also shared the ways to embedd the + button blooger and other self-hosted websites/blogs.

However, it turned out theat Google didn’t optimized the +1 buttons embedd code. Aaron Peters explains, that Google’s code blocks page loading if you place it inside the <head> tag, so it’s better to place it before you close the <body> tag. An even better idea is to load the Google +1 script in a non-blocking way, just like Google did with Google Analytics, AdSense and Google Related Links.

Aaron also noticed that the JavaScript code isn’t minified, browsers can only cache the JavaScript file for 6 minutes and there’s a mistake in the code from this page: “http” should be replaced with “https” to avoid an unnecessary redirect.

Aaron suggests following embedding code:


Apparently, the code doesn’t work in Blogger by default. Luckily, there’s a workaround, but it requires you to edit Blogger’s template files. Basically you can replace with the code generated by Blogger (“view source” is your friend), then delete: .

Code for Blogger pages:

function shouldLoadSync() {
 if(window["___gapisync"] === !0) {
 for(var metas = document.getElementsByTagName("meta"), i = 0;i < metas.length;++i) {
  var meta ="" metas[i];
   if("generator" ="=" meta.getattribute("name") && "blogger" ="=" meta.getattribute("content")) {


Share This Story, Choose Your Platform!

Get Latest News

Subscribe to Digital News Hub

Get our daily newsletter about the latest news in the industry.
First Name
Last Name
Email address
Secure and Spam free...