SEO Class 24.9: Google Analytics Introduced. (English and Tamil) Search Analyst Sasikumar Talks

To integrate Google Analytics into a basic HTML page, you need to include the tracking script provided by Google Analytics. Here’s how you can do it:

Steps to Add Google Analytics

  1. Sign in to your Google Analytics account.
  2. Create a property to get your Measurement ID.
  3. Copy the Google Analytics tracking code snippet.
  4. Paste it into the <head> section of your HTML file.

Example of Basic HTML with Google Analytics

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Website with Google Analytics</title>
    <!-- Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_MEASUREMENT_ID"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());

        gtag('config', 'YOUR_MEASUREMENT_ID');
    </script>
    <!-- End Google Analytics -->
</head>
<body>
    <header>
        <h1>Welcome to My Website</h1>
    </header>
    <nav>
        <ul>
            <li><a href="#about">About</a></li>
            <li><a href="#services">Services</a></li>
            <li><a href="#contact">Contact</a></li>
        </ul>
    </nav>
    <main>
        <section id="about">
            <h2>About Us</h2>
            <p>We are a company that values simplicity and clarity.</p>
        </section>
        <section id="services">
            <h2>Our Services</h2>
            <ul>
                <li>Web Development</li>
                <li>App Development</li>
                <li>SEO Optimization</li>
            </ul>
        </section>
        <section id="contact">
            <h2>Contact Us</h2>
            <p>Email: <a href="mailto:info@example.com">info@example.com</a></p>
        </section>
    </main>
    <footer>
        <p>&copy; 2025 My Website. All rights reserved.</p>
    </footer>
</body>
</html>

Replace YOUR_MEASUREMENT_ID

  • Replace YOUR_MEASUREMENT_ID with the actual Measurement ID provided by Google Analytics (e.g., G-XXXXXXXXXX).

Now, when visitors browse your website, their interactions will be tracked and reported in your Google Analytics dashboard. Let me know if you need further clarification!