Fix Blogger Tracking Your Pageviews

Your blog's quick stats on the dashboard reflects the number of page views your blog received in a given time window, the stats can be inaccurate as it might also be counting your own pageviews.

Blogger does provide an option to stop tracking your pageview, though it doesn't work properly for many Blogger users.

Of course many blog owners might not want to track their own pageviews, especially when even low number of page views from their side may affect the overall stats, so it makes perfect sense that you may want to tell Blogger to stop tracking in on your account.

We recently started getting a lot of queries about "why blogger is still tracking my pageviews" and similar, on Twitter and in the forums in large quantity. Here's a tweet from a Blogger user with the hashtag #gHelp seeking for help with the issue



The most straightforward option is to set the option in your blog's dashboard, that can be done by following these steps (these are optional steps, you may have turned it on already):
  1. Go to your Blogger Dashboard
  2. Select the Stats -> Overview tab & then click on "Manage tracking your own pageviews"
  3. You shall be now taken to a new tab with the following URL format: https://[yourblog].blogspot.com/b/statsCookieManage
  4. Check the box that says "Don't track my views for this blog.", and that's it.
This is supposed to stop tracking your pageviews on the blog, but if you test it you will find that it doesn't work. You can check this if it works or not by refreshing your blog in the browser, and after that refresh the stats on your blogger dashboard - you will see that the views are still being counted rendering the option to turn it off completely useless. 

A Valid Workaround

We know that it doesn't work, and Blogger engineers are still on it to fix it, but meanwhile many blog owners are affected and this has to be fixed somehow. 

To tell Blogger to not count your pageview is not a magic, the technique is to set a cookie on your browser so that whenever you load your blog the server knows that you do not want your pageviews to be counted, if the cookie, which is nothing but a small text file saved for websites that contains data used by the browser and server, is not available it counts your views.

What the problem is

(You may want to move to the next section if you want to just know how to fix it)
The error is with where the cookie is set when you go to the options page that let's you choose if you want the blog to stop tracking your pageviews. 

The URL is: https://[yourblog].blogspot.com/b/statsCookieManage

The cookie named "_ns" with the value of "2" is supposed to be set on blog address, but due to an error on the Blogger system the cookie is only set on the /b whereas it is supposed to be set on the "/" path which signifies that it must work on every page of your blog, but due to the error it is not.

Here are some screenshots with the information of cookies that is set while we toggle the option



Everything seems to work okay. As you can see, when the option in the second image in unchecked (highlighted in orange), the cookie named "_ns" disappears. That is how it is supposed to work, the problem actually is its Path value set to /b

And as the path is set to /b the cookie appears no where on the blog except for the page that starts on the path /b

The Workaround

To make this work i.e to have Blogger stop counting our own pageviews we just have to set a cookie on the blog, but this time manually as the options page that Blogger provides us doesn't work properly. 

That can be done with a simple JavaScript snippet. All we will do is set a cookie with the name "_ns" and the value  "2" on the root path of your blog. 

Without any further delay here's the code we need (copy it to your clipboard):

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

createCookie("_ns", "2", 999);

The snippet will create a cookie with the passed values in createCookie("_ns", "2", 999);, you do not need to understand anything about this for it work, only thing you might be interested is the number of days this cookie will be valid for, in the code we have set it to 999 days, after that the cookie will be removed itself from the browser. You can set the value higher or lower if you like.

Using the code snippet

After you have copied the code open your blog's homepage. To run this code you need to access the JavaScript console, there are different ways to open the console in different browsers, I am mentioning how to do it in Chrome and Firefox

Google Chrome

You can open the console using the keyboard shortcut CTRL+Shift+J / F12 on Windows or CMD+Option+J, or you could right click on an empty area in the web page, then select Inspect and switch to the Console tab.

Following screenshot shows the code entered in the JavaScript console on Chrome.




After pasting the code in place, hit enter and that's it. The cookie is set and now until the cookie expires or is manually removed (by clearing cookies off your browser) Blogger would not count your page-views when you access your blog from the browser.

Mozilla Firefox

To open the console in Firefox: CTRL+Shift+K on Windows or +Option+K on Mac. Or you could Right Click, then choose Inspect Element and then go to the Console tab.

Enter the code in the console window and hit enter. Here's how it must look like in Mozilla Firefox:



On Safari

On your Safari browser click on the Develop menu and select "Show JavaScript Console" to open the JavaScript console where you will be entering the script you copied above. 

If you don’t see the Develop menu in the menu bar, choose Safari > Preferences, click Advanced, then select “Show Develop menu in menu bar.”.


Important note: If you are on .blogspot.com URL then check which version of your blogspot has loaded, Blogger mainly redirects .blogspot.com URLs based on the visitors country, so if you are in the UK it will change to .blogspot.co.uk. Setting the cookie on .blogspot.co.uk or your country specific TLD won't work on other country specific TLDs. You can set the cookie on all of the variants if you like. 

The Cookie's now set. That's it.

Now that you have run the code the cookie that we have been mentioning throughout the post will be set on in your browser. As long as the cookie stays in the browser any visits to your blog from that browser would not be counted towards the pageviews of your blog. 

If you use different browsers, you may also use this code in those to stop tracking the pageviews from those as well. 

Note that it is possible in browsers to set an option that deletes any cookies on a site once it is closed, so I recommend you to look for the option for cookies in your browser if this doesn't seem to work, if problem continues please post a comment on this post.

HTTPS Will Be Available by Default on Blogger Blogs

It was not long when the users were given the super-heroes like powers to serve their blogs (on .blogspot.com) over the secure protocol https which is good in many ways, but it was something not always liked by the masses and there are reasons behind it (which we will discuss soon.)

A little background on the matter if you are not sure what this is about:
Last year in September Blogger announced the support for enabling HTTPS (HyperText Transfer Protocol Secure) on their blogs. Blogger has now been sending notification to Blogger users with the following message:
Coming in late April! 
All visitors will be able to view your Blogspot domain blogs over an encrypted connection by visiting https://<your-blog>.blogspot.com. Existing links and bookmarks to your blogs will continue to work. As part of this change, the HTTPS Availability setting will disappear, and your blogs will always have an HTTPS version.
If you were unaware of the updates of support for HTTPS encryption this might come as a surprise.

A lot of blogger users who were not using a custom domain for their blogs tried out the setting to serve their blog over https many didn't see any change, but most of them didn't like it, the reason are many, HTTPS encryption is secure, it is the preferred protocol for any website that transacts important data over the internet to keep it safe.

It is that security which disturbed many users when they used the feature to enable HTTPS, it resulted into errors in the functionality of many blogs which was caused due to mixed content.

Please also see this pinned post on the official Blogger Help Forums which explains the matter with more details:
https://productforums.google.com/forum/?utm_medium=email&utm_source=footer#!topic/blogger/JGcHNmtIPiE

How does it affect my blog?

First of all coming back to the message: There have been no announcements on the blog with detailed explanation of what is going to change. The notification message on the Blogger dashboard implies that the settings for enabling https will go away as starting late April everyone can visit your blog over the encrypted protocol i.e https://.

To begin with, you may want to learn more about HTTPS

Are custom domain affected?

No, blogger blogs with custom domain can not be accessed on the https:// protocol. Only the blogs on <your-blog>.blogspot.com will see this change.

My Blogs will always be served over HTTPS?

There hasn't been any updates regarding this on the official blogs but from what we can see in the notification message it means that both versions will be available, a visitor would be able to either visit the HTTPS or the HTTP version.

Depending on what the user type in the protocol part of your blog address, for example if the users type: https://blogname.blogspot.com  the secure version would be served, or if http is used, then the traditional http version. 

It is difficult to say what the actual behavior would be, as Google wants to make each of their products available on the secure protocol, it is possible that the default protocol for all blogs may be changed to HTTPS. 

Impact on old URLs and Search
As for bookmarks, old URLs etc, it may come in as a relief that those would continue working, as HTTPS availablity is the choice of the user, if they want they can visit the blog over HTTP by simply typing http:// before the URL, however there is still no information how would search engines treat this change, the question is that what version would be by default indexed by the search engines?

We do not still have much information on this, when the changes are rolled out and we have more details we will update our blog with more insight on this, so please follow our blog.

What are the benefits?

There are certainly benefits in having your blog served over HTTPS, most important of all is a sign of trust, HTTPS protocol as the name suggest is the secure way of serving content and having that on your blog as well gives the readers a sense of genuineness.

Here are some benefits of using it (mentioned here on this official BHF thread)
  1. It helps check that your visitors open the correct blog and aren’t being redirected to a malicious site.
  2. It helps detect if an attacker tries to change any data sent from Blogspot to the visitor.
  3. It adds security measures that make it harder for other people to listen to your visitors’ conversations, track their activities, or steal their information.

The disadvantage

Mixed content warnings are common to websites and blogs which has sub-resources on the lesser secure or as Google likes to call it insecure protocol, HTTP.

What this has to do with Blogger blogs? Well, if you like to add widgets and other stuffs on your blog from different sources it is quite possible your blog may be a victim of mixed content warnings if those widgets/scripts refers to any resource that is on the HTTP protocol, as these resources can be possiblity used by the unethical people to steal data even from sites with HTTPS encryption.

This is a disadvantage if your need of HTTPS has less importance than the widgets/scripts you use on your blog. Anyways it is not recommended to include these from sources you do not trust, and mostly the third-parties who provide these must be wise enough to serve their content over HTTPS too if they really want to help the users. 

These are some resources to prepare yourself for any mixed-content warnings you may possibly get on your blog when these updates from Blogger regarding HTTPS changes rolls out. You may consider it doing now to futureproof your blog.

Blogger Help: Fix mixed content on your blog

What's next

There's nothing you have to do in order for this change to take effect, later near the end of April this will roll-out to all the blogspot blogs. 

Furthermore there might be some extra measures that needs to be taken once the changes are rolled out. We will keep updating this space for future updates on the topic, you can also follow StramaXon Blog & Gioogle Blogger Official Blog