Avatar of trowa
trowa
 asked on

How to measure website bounce rate?

I got one requirement which not allowed to use Google Analytics for web tracking analysis. Instead, my client wishes to have an CMS which keep track of some web traffic data, such as bounce rate, etc.

My question is how do I track the bounce rate in my database? What information should I save into database?

I need some insights so that I can understand it, thank you.
Web DevelopmentContent ManagementASP.NETJavaScriptSearch Engine Optimization (SEO)

Avatar of undefined
Last Comment
trowa

8/22/2022 - Mon
Shailesh Shinde

Hi,

A bounce occurs when a web site visitor only views a single page on a website, that is, the visitor leaves a site without visiting any other pages before a specified session-timeout occurs. There is no industry standard minimum or maximum time by which a visitor must leave in order for a bounce to occur. Rather, this is determined by the session timeout of the analytics tracking software.
If user visited to any other page from first page links can be check.

best describe at https://en.wikipedia.org/wiki/Bounce_rate

Thanks,
Shail
trowa

ASKER
Hi thanks, but I would like to know how to do that using our own scripts, preferably ASP.NET.

Thank you.
Virat Singh

ASP.NET Web Pages includes several analytics helpers (Analytics.GetGoogleHtml, Analytics.GetYahooHtml and Analytics.GetStatCounterHtml  that make it easy to manage the JavaScript snippets used for analytics. Instead of figuring out how and where to put the JavaScript code, all you have to do is add the helper to a page. The only information you need to provide is your account name, ID, or tracking code. (For StatCounter, you also have to provide a few additional values.)+

In this procedure, you'll create a layout page that uses the GetGoogleHtml helper. If you already have an account with one of the other analytics providers, you can use that account instead and make slight adjustments as needed.

Note: When you create an analytics account, you register the URL of the site that you want to be tracking. If you're testing everything on your local computer, you won't be tracking actual traffic (the only traffic is you), so you won't be able to record and view site statistics. But this procedure shows how you add an analytics helper to a page. When you publish your site, the live site will send information to your analytics provider.

Add the ASP.NET Web Helpers Library to your website as described in Installing Helpers in an ASP.NET Web Pages Site, if you haven't already added it.
Create an account with Google Analytics and record the account name.
Create a layout page named Analytics.cshtml and add the following markup

@using Microsoft.Web.Helpers;
<!DOCTYPE html>
<html>
  <head>
    <title>Analytics Test</title>
  </head>
  <body>
    <h1>Analytics Test Page</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
    <div id="footer">
      &copy; 2012 MySite
    </div>
    @Analytics.GetGoogleHtml("myaccount")
  </body>
</html>

Open in new window


Note: You must place the call to the Analytics helper in the body of your web page (before the </body> tag). Otherwise, the browser will not run the script.

Replace myaccount with the name of the account, ID, or tracking code that you created in step 1.
Run the page in the browser. (Make sure the page is selected in the Files workspace before you run it.)
In the browser, view the page source. You'll be able to see the rendered analytics code:

<!DOCTYPE html>
<html>
  <head>
    <title>Analytics Test</title>
  </head>
  <body>
    <h1>Analytics Test Page</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
    <div id="footer">
      &copy; 2012 MySite
    </div>
    <script type="text/javascript">
      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
      document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
      try{
      var pageTracker = _gat._getTracker("myaccount");
      pageTracker._trackPageview();
      } catch(err) {}
    </script>
  </body>
</html>

Open in new window


Log onto the Google Analytics site and examine the statistics for your site. If you're running the page on a live site, you see an entry that logs the visit to your page.

Hope it helps
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
trowa

ASKER
Thanks Virat for detailed explanation! but as mentioned in the question, I'm not allowed to use Google Analytics. The client would like to keep everything in their umbrella.

Do you have any other resources or concept can share with me to track bounce rate without using Google Analytics and other online tools?
trowa

ASKER
anyone got further inputs?
Virat Singh

Hey have you checked PIWIK.
Its a open source analytics application
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
trowa

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
trowa

ASKER
No appropriate answer was received.

Suggest to close this question instead of delete so it may receive comments in future.