Analytics Dashboard
❌ Wrong password. Try again.
🔒 Authorized access only

📋 Apps Script Setup

Yeh steps follow karo apna tracking system activate karne ke liye:

  1. Jao script.google.comNew Project
  2. Pura neeche wala code paste karo
  3. Click: Deploy → New Deployment → Web App
  4. Set: Execute as: Me | Who has access: Anyone
  5. Deploy karo → URL copy karo → Setup mein paste karo
Google Apps Script Code
const SHEET_NAME = 'Analytics';
const SECRET = 'cp2024secret'; // optional security

function doGet(e) {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  let sheet = ss.getSheetByName(SHEET_NAME);
  if (!sheet) {
    sheet = ss.insertSheet(SHEET_NAME);
    sheet.appendRow(['Timestamp','Page','Referrer','UserAgent','Screen','City']);
    sheet.setFrozenRows(1);
  }
  const action = e.parameter.action;

  if (action === 'track') {
    sheet.appendRow([
      new Date().toISOString(),
      e.parameter.page  || '/',
      e.parameter.ref   || 'direct',
      e.parameter.ua    || '',
      e.parameter.screen|| '',
      ''
    ]);
    return ContentService
      .createTextOutput('ok')
      .setMimeType(ContentService.MimeType.TEXT);
  }

  if (action === 'stats') {
    const data = sheet.getDataRange().getValues();
    const rows = data.slice(1);
    const now  = new Date();
    const today   = now.toISOString().split('T')[0];
    const weekAgo = new Date(now - 7*24*60*60*1000);
    const monthAgo= new Date(now - 30*24*60*60*1000);
    let todayC=0, weekC=0, monthC=0;
    const daily={}, refs={};
    rows.forEach(r => {
      const ts = new Date(r[0]);
      const ds = ts.toISOString().split('T')[0];
      if (ds===today) todayC++;
      if (ts>=weekAgo)  weekC++;
      if (ts>=monthAgo) monthC++;
      daily[ds] = (daily[ds]||0)+1;
      const ref = r[2]||'direct';
      refs[ref] = (refs[ref]||0)+1;
    });
    const recent = rows.slice(-50).reverse().slice(0,25).map(r=>({
      time:r[0], page:r[1], ref:r[2], ua:r[3]
    }));
    return ContentService
      .createTextOutput(JSON.stringify({
        total:rows.length, today:todayC,
        week:weekC, month:monthC,
        daily, refs, recent
      }))
      .setMimeType(ContentService.MimeType.JSON);
  }

  return ContentService.createTextOutput('CP Analytics API v1')
    .setMimeType(ContentService.MimeType.TEXT);
}

Portfolio mein add karo — index.html ke </body> se pehle:

<script>
(function(){
  var url='YOUR_SCRIPT_URL_HERE';
  fetch(url+'?action=track&page='+
    encodeURIComponent(location.pathname)+'&ref='+
    encodeURIComponent(document.referrer)+'&ua='+
    encodeURIComponent(navigator.userAgent)+'&screen='+
    encodeURIComponent(screen.width+'x'+screen.height),
    {mode:'no-cors'}
  );
})();
</script>
⚙️ Setup Apps Script URL
Apna Google Apps Script web app URL yahan paste karo.
Pehli baar setup kar rahe ho? Yahan dekho full instructions →
URL kuch aisa dikhega: https://script.google.com/macros/s/AKfycb.../exec
VISITOR ANALYTICS
Portfolio performance at a glance
Total Visits
All time
Today
Last 24h
This Week
Last 7 days
This Month
Last 30 days
Daily Visits
Last 7 Days
Traffic Sources
Top Referrers
Loading...
Recent Visitors
Latest 25
# Time Page Referrer / Source Device
Loading data...
CP. Admin Dashboard — Auto-refreshes every 60 sec