Javascript code to Reduce Bounce Rate by 50% using Force redirects method

A simple javascript code that can reduce your bounce rate. What is bounce rate basically? By Mathematical formula the bounce rate is=Total number of bounces across all the pages on the website in a given time/ Total number of entries across all the pages on the website on the same time * 100

Example: Suppose if you have 100 pages. For a given period of time of bounce rate calculation, your number of entries pages is 80, say after first visiting your web pages, out of 80, 70 users leave your site immediately, then your total number of bounces is 70. So, your Bounce Rate will be 70/80*100=87.5

Which is very high rate bounce rate. Note that bounce rate for a normal blog below 50% is normal but above 50% bounce rate is worrying. There are more options to reduce bounce rate. These the non techniacal methods to do so. Today we will show to to reduce bounce rate using javascript redirect method.


Step 1:

Create a folder in root directory in your website say,

Step 2:

create a new file with .js extension, say it is redirect.js

Step 3:

Put the code given below in the redirect.js file and change the url located at location.replace(““); with your desired post. Upload the redirect.js script in the folder called

To verify you may locate the script by entering full url

If you see the code, you have successfully installed the reduce bounce rate script.

Step 4:

After that put this small javascript line in the posts that you want to redirect.

Thus you can create multiple redirection javascrip files inside the folder and redirect them in different different post.

For demo if you click on back button of this post, it will redirect to our home page.

Example Result:

reduce bounce rate using javascript

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Share this


  1. Jan Afridi
    • Praan
  2. Saloni
    • Praan
  3. Aman Patel
    • Praan Kumar

Leave a Reply

%d bloggers like this: