<!DOCTYPE html>
<html>
<head>
  <title>AdSense Revenue Calculator</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    body {
      font-family: Arial, sans-serif;
      text-align: center;
      background-color: #f1f1f1;
      margin: 0;
      padding: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
    }

    .container {
      max-width: 90%;
      padding: 20px;
      border: 1px solid #ccc;
      border-radius: 10px;
      background-color: #fff;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    h2 {
      color: #333;
      margin-bottom: 20px;
    }

    label {
      display: block;
      text-align: left;
      margin-bottom: 5px;
      color: #555;
      font-weight: bold;
    }

    input[type="number"] {
      width: 100%;
      padding: 10px;
      margin-bottom: 15px;
      box-sizing: border-box;
      border: 1px solid #ccc;
      border-radius: 5px;
    }

    button {
      background-color: #4CAF50;
      color: #fff;
      padding: 10px 20px;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      transition: background-color 0.3s;
    }

    button:hover {
      background-color: #45a049;
    }

    .result {
      font-weight: bold;
      margin-top: 20px;
      color: #555;
    }

    @media screen and (max-width: 600px) {
      .container {
        max-width: 100%;
      }
    }
  </style>
</head>
<body>
  <div class="container">
    <h2>AdSense Revenue Calculator</h2>
    <label for="pageviews">Pageviews:</label>
    <input type="number" id="pageviews" placeholder="Enter pageviews">

    <label for="clicks">Clicks:</label>
    <input type="number" id="clicks" placeholder="Enter clicks">

    <label for="cpc">Cost Per Click (CPC):</label>
    <input type="number" id="cpc" placeholder="Enter CPC">

    <label for="ctr">Click-Through Rate (CTR):</label>
    <input type="number" step="0.01" id="ctr" placeholder="Enter CTR">

    <button onclick="calculateRevenue()">Calculate</button>

    <div class="result" id="revenueResult"></div>
  </div>

  <script>
    function calculateRevenue() {
      var pageviews = parseFloat(document.getElementById('pageviews').value);
      var clicks = parseFloat(document.getElementById('clicks').value);
      var cpc = parseFloat(document.getElementById('cpc').value);
      var ctr = parseFloat(document.getElementById('ctr').value);

      if (isNaN(pageviews) || isNaN(clicks) || isNaN(cpc) || isNaN(ctr)) {
        document.getElementById('revenueResult').innerHTML = 'Please enter valid values.';
      } else {
        var revenue = (pageviews * clicks * cpc * ctr) / 100;
        document.getElementById('revenueResult').innerHTML = 'Estimated Revenue: $' + revenue.toFixed(2);
      }
    }
  </script>
</body>
</html>

By kazafi

Leave a Reply

Your email address will not be published. Required fields are marked *