Sunday, January 19, 2014

How to enable "stay on a page or leave" pop up in your blog

"Stay on a page or leave it" is a pop up which definitely helps us to reduce the bounce rate of a blog.  I hope most of the bloggers are aware of this. Here in this post we are going to learn how to add this pop up in your blog using jquery java function. Don't be upset its not a big deal but just will take only five minutes. 


What is  "stay on a page or leave" pop up?

It is a pop up which will show to your site viewers when ever they exit your web page from their browser. The pop up will have two option i.e whether to leave page or to stay on page (You can change option text).

Why should I add this pop up in my blog ?

Now the question is why should I add this to my blog. Ok I have very good reason for this. I hope we all are aware of bounce rate (Bounce Rate is the percentage of single-page visits i.e. visits in which the person left your site from the entrance page without interacting with the page) which is a important parameter used in our site evaluation by google and also helps in to take part in google adsense program easily. So every blogger should try to reduce bounce rate of his blog. Now I hope we've got the point that why should we add this pop up option in my blog. This will surely helps you to reduce the bounce rate of your blog by keeping the visitors on your blog.

How to enable "stay on a page or leave" pop up in your blog:

STEP 1. Go to Blogger Dashboard-->Template-->Edit HTML
STEP 2. Find (using cntrl+F) </head> tag and place the following code just above of it.

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'/>
<script type='text/javascript'>
     function PopIt() { return &quot;Are you sure you want to leave?&quot;; }
     function UnPopIt()  { /* nothing to return */ }

     $(document).ready(function() {
      window.onbeforeunload = PopIt;
 $(&quot;a&quot;).click(function(){ window.onbeforeunload = UnPopIt; });
     });
</script>

Note: Replace "Are you sure you want to leave" with your desired text.

Now next step is to save the code and you are all done.
Now next time whenever a visitor will leave your page he will get this pop up. I hope this will helps you to reduce your bounce rate.
Leave your feedbacks.

No comments:

Post a Comment

© All about engineering, AllRightsReserved.