---
title: "How to use Google Analytics in Deno Deploy"
description: "Server-side Google Analytics on Deno Deploy sidesteps ad blockers, which Deno says over 70% of its audience uses, and gives more reliable tracking than the client-side snippet."
url: "https://swe.quest/articles/how-to-use-google-analytics-in-deno-deploy-7d1a9e6159a166b9"
canonical: "https://deno.com/blog/ga-with-deno-deploy"
source: "Deno"
published: "2022-03-08"
difficulty: "medium"
kind: "How-to"
reading_minutes: 2
tags: ["serverless","typescript","observability"]
---

# How to use Google Analytics in Deno Deploy

A post on [Deno](https://swe.quest/sources/deno.md), published 2022-03-08, 2 min read, How-to. Original: [https://deno.com/blog/ga-with-deno-deploy](https://deno.com/blog/ga-with-deno-deploy)

## Summary

Server-side Google Analytics on Deno Deploy sidesteps ad blockers, which Deno says over 70% of its audience uses, and gives more reliable tracking than the client-side snippet. The g\_a module offers createReporter, which logs each request, response, timing and error from a std/http serve handler, and createReportMiddleware for oak apps. The tracking ID can be passed in code or set as the GA\_TRACKING\_ID environment variable in Deploy settings. The module supports only the now-retired Universal Analytics, with GA4 and event support under investigation.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- Deno basics
- HTTP server handlers

## Keywords

Deno Deploy, Google Analytics, Universal Analytics, oak, g\_a

## Related posts

- [How to get deep traces in your Node.js backend with OTel and Deno](https://swe.quest/articles/how-to-get-deep-traces-in-your-node-js-backend-with-otel-and-deno-e60be1ff8da59b5c.md): Deno · 2025-03-13 · Medium · 6 min read · Observability, JavaScript, Runtimes & VMs
  Running an unmodified Node.js Express server under Deno 2.2+ with the \`--unstable-otel\` flag yields OpenTelemetry traces and span-correlated logs with no code changes.
- [Build a dinosaur runner game with Deno, pt. 6](https://swe.quest/articles/build-a-dinosaur-runner-game-with-deno-pt-6-d21d409df6156ed0.md): Deno · 2026-02-23 · Medium · 9 min read · Observability, JavaScript, TypeScript
  The final stage of the Deno dinosaur runner series adds observability using Deno Deploy's built-in logs, traces and metrics dashboards.
- [Run npm and Deno anywhere](https://swe.quest/articles/run-npm-and-deno-anywhere-02ce4590033c3918.md): Deno · 2022-11-18 · Medium · 7 min read · Deployment, Containers, Cloud platforms, JavaScript
  Deno apps, including those using npm specifiers, can be containerized with the official denoland/deno Docker image and deployed to any VPS or container platform, not just Deno Deploy.
- [Deno 1.8 Release Notes](https://swe.quest/articles/deno-1-8-release-notes-b5cc182091f0ac84.md): Deno · 2021-03-02 · Medium · 11 min read · JavaScript, Runtimes & VMs, Testing, Developer tools
  Deno 1.8 adds experimental WebGPU support (built on wgpu/gfx-rs) aimed at GPU-accelerated ML such as running TensorFlow.js, ships full ICU so all JS Intl APIs match browsers, and stabilizes import maps, which can now be loaded from URLs.
- [How to setup a blog with Hugo and Deno Deploy](https://swe.quest/articles/how-to-setup-a-blog-with-hugo-and-deno-deploy-7b19707c0d32a809.md): Deno · 2022-04-27 · Medium · 5 min read · CI/CD, Deployment, CDN & edge, JavaScript
  A Hugo static site can be published on Deno Deploy by building it in GitHub Actions and serving the generated public directory with Deno's standard-library file server, imported directly by URL with no download or compile step.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
