Send Antlytics data to Google Sheets
Log your daily Antlytics stats to a Google Sheet for historical tracking, custom charts, and team reporting.
Option A: Apps Script (no third-party tools)
Google Apps Script can call the Antlytics API on a daily schedule.
Setup
- Open a Google Sheet → Extensions → Apps Script.
- Replace the default code with the script below.
- Replace
YOUR_API_TOKENandYOUR_SITE_IDwith values from Settings → API tokens and your site's tracking ID. - Run
setupTrigger()once to register the daily trigger.
const API_TOKEN = 'ant_YOUR_API_TOKEN';
const SITE_ID = 'YOUR_SITE_ID';
function fetchStats() {
const url = `https://www.antlytics.com/api/v1/stats?site_id=${SITE_ID}`;
const res = UrlFetchApp.fetch(url, {
headers: { Authorization: `Bearer ${API_TOKEN}` },
muteHttpExceptions: true,
});
if (res.getResponseCode() !== 200) {
console.error('API error:', res.getContentText());
return;
}
const { visitors, pageviews, bounce_rate } = JSON.parse(res.getContentText());
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
if (sheet.getLastRow() === 0) {
sheet.appendRow(['Date', 'Visitors', 'Pageviews', 'Bounce rate (%)']);
}
const today = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), 'yyyy-MM-dd');
sheet.appendRow([today, visitors, pageviews, bounce_rate]);
}
function setupTrigger() {
ScriptApp.newTrigger('fetchStats')
.timeBased()
.everyDays(1)
.atHour(9)
.create();
}
- Click Run → fetchStats once to add today's row and verify permissions.
Option B: Via Zapier or Make
For a no-code approach, use Zapier or Make:
- Connect Antlytics to Zapier/Make via Settings → Webhooks.
- Add a Google Sheets → Create Spreadsheet Row action.
- Map
period,stats.visitors,stats.pageviews, andstats.bounce_rateto columns.
Need help?
Email support@antlytics.com with your site ID.
Something missing? Get in touch and we will update these docs.