{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-11-09T11:26:19Z","object_id":{"id":1466,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_admin_menu","title":"observe_admin_menu\/3","uri":"https:\/\/zotonic.com\/id\/1466"},"seq":1},{"created":"2026-11-09T11:26:19Z","object_id":{"id":1816,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_email_failed","title":"observe_email_failed\/2","uri":"https:\/\/zotonic.com\/id\/1816"},"seq":2},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2005,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_module_activate","title":"observe_module_activate\/2","uri":"https:\/\/zotonic.com\/id\/2005"},"seq":3},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2105,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_email_bounced","title":"observe_email_bounced\/2","uri":"https:\/\/zotonic.com\/id\/2105"},"seq":4},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2108,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_email_sent","title":"observe_email_sent\/2","uri":"https:\/\/zotonic.com\/id\/2108"},"seq":5},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2159,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_module_deactivate","title":"observe_module_deactivate\/2","uri":"https:\/\/zotonic.com\/id\/2159"},"seq":6},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2319,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_middleware","title":"observe_middleware\/3","uri":"https:\/\/zotonic.com\/id\/2319"},"seq":7}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-11-09T11:26:19Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2566,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_operator","title":"Operator","uri":"https:\/\/zotonic.com\/id\/2566"},"seq":3},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2593,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_privacy_and_consent","title":"Privacy and consent","uri":"https:\/\/zotonic.com\/id\/2593"},"seq":4},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2595,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_email_delivery","title":"Email delivery","uri":"https:\/\/zotonic.com\/id\/2595"},"seq":5},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2607,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_logging_and_monitoring","title":"Logging and monitoring","uri":"https:\/\/zotonic.com\/id\/2607"},"seq":6},{"created":"2026-11-09T11:26:19Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":7}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"export_revision":96,"id":3149,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3149"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_module_mod_analytics","page_url":{"en":"https:\/\/zotonic.com\/docs\/3149\/mod_analytics","x-default":"https:\/\/zotonic.com\/docs\/3149\/mod_analytics"},"preview_url":null,"resource":{"version":68,"pivot_location_lat":null,"title":"mod_analytics","is_authoritative":true,"body":"<p>Site Analytics measures site traffic, popular content, outgoing email activity and\nmodule-defined events without an external tracker. It helps operators understand\nsite usage and operational trends without storing visitor identifiers, tracking\ncookies or raw request logs.<\/p>\n<h2>When to use it<\/h2>\n<p>Use this module for aggregate counts and trends, not unique-visitor measurement,\nbilling or an audit trail. It counts requests that reach Zotonic; requests served\nentirely by a CDN are not counted. Collection is best-effort, and reports identify\nincomplete data. Run one collecting node per site; distributed collection is not\nsupported.<\/p>\n<h2>Getting started<\/h2>\n<ol><li>Enable <code>mod_analytics<\/code> in the site&#39;s Modules screen.<\/li><li>Open <strong>Content → Site Analytics<\/strong> to view the standard recordings.<\/li><li>Open <strong>System → Analytics configuration<\/strong> to add recordings or pause\/resume\nexisting ones. The default Languages recording starts paused.<\/li><\/ol>\n<p>For example, add a recording for <strong>HTTP API requests<\/strong> with a <code>status<\/code> breakdown\nto compare successful responses and errors. New recordings collect future events;\nthere is no historical backfill.<\/p>\n<h2>Configuration and usage<\/h2>\n<p>A recording selects one event, fixed filters and at most one breakdown dimension.\nUse totals for overall activity, breakdowns to compare groups, and filters to\nselect the population of interest. Popular content shows approximate rankings\nwith count ranges, rather than unique visitors or exact ranks.<\/p>\n<p>Definitions are immutable: create a new recording to change what is measured.\nPausing preserves history and its storage reservation. Deleting a recording\nremoves its history and releases that reservation. Drag recordings in configuration\nto change their dashboard order without changing their data.<\/p>\n<p>Per-site settings under <code>mod_analytics<\/code>:<\/p>\n<table class=\"table\"><thead><tr><th>Key<\/th><th>Default<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td><code>row_budget<\/code><\/td><td><code>1000000<\/code><\/td><td>Maximum reserved group\/time slots across retained recordings; not physical SQL rows or bytes.<\/td><\/tr><tr><td><code>require_consent<\/code><\/td><td><code>false<\/code><\/td><td>Require <code>analytics_consent = true<\/code> in the context for request-associated events.<\/td><\/tr><\/tbody><\/table>\n<p>Reports require <code>use mod_analytics<\/code>. Configuration and recording mutations require\nsite administrator access (<code>use mod_admin_config<\/code>). These permissions are independent.<\/p>\n<h2>What is counted<\/h2>\n<p>Page events count successful public HTML GET responses, including eligible template\npages without a resource ID. A user who can edit the resolved resource is excluded\nfrom that resource&#39;s views, including frontend previews and direct visits. Admin\naccess alone does not exclude a resource view. Without a resource ID, users with\n<code>use mod_admin<\/code> are excluded. Read-only sessions cannot edit resources and can\ntherefore count as resource views. This applies to both <code>page_request<\/code> and the\npage type of <code>request<\/code> events.<\/p>\n<p>API and other classified requests can count errors and expose their final HTTP\nstatus. They continue to exclude users with <code>use mod_admin<\/code>. All request types\nrespect <code>analytics_exclude<\/code> and the configured consent requirement. Sites supply\nthe consent flag through their own integration. DNT and GPC headers do not exclude\nrequests from these aggregate counts.<\/p>\n<p>The <code>traffic<\/code> dimension distinguishes declared user-triggered agents, crawlers,\nother clients and unknown clients. These are classifications, not verified\nidentities; <code>other<\/code> does not necessarily mean human. Page totals, device breakdowns\nand popular content exclude detected agents and crawlers unless a recording\nexplicitly selects them. Traffic-classification and API measurements include them\nunless filtered out.<\/p>\n<p>SMTP observers count sent, retry, failed and bounced notifications independently\nof requests. These are transport events, not unique emails, inbox deliveries or\nopens. Traffic Guard can add would-throttle and throttled attempts to the default\nPage requests chart. Guard attempts and page views overlap; do not sum them.<\/p>\n<h2>Integration<\/h2>\n<p><code>controller_page<\/code> and <code>controller_template<\/code> default to the <code>page<\/code> dispatch analytics\ntype; <code>controller_api<\/code> defaults to <code>api<\/code>. Override with <code>{analytics, Type}<\/code>, or\nexclude a route with <code>{analytics, false}<\/code>. Other controllers are opt-in. Dedicated\nagent interfaces expose their own dispatch types. MQTT model calls are not counted\nby HTTP request analytics.<\/p>\n<p>Modules declare namespaced events with the <code>analytics_events<\/code> fold notification.\nCall <code>m_analytics:record_event\/3<\/code> for background events, or <code>\/4<\/code> to associate an\nevent explicitly with the current request. Declare coarse dimensions and avoid\npersonal data or free-form input. See <code>m_analytics<\/code> and the application README for\ncalling conventions, schemas and examples.<\/p>\n<h2>Implementation and operational limits<\/h2>\n<p>A bounded ingress queue feeds an aggregation worker and a separate database writer.\nCounters are stored asynchronously in capped minute, quarter-hour, hour and day\nslots in the site&#39;s PostgreSQL database. Popular content uses bounded approximate\nsummaries over moving periods. No database call is needed on the normal ingestion\npath.<\/p>\n<p>Overload, outages or restarts can lose buffered events; committed history survives\nrestarts. Reports show gaps or partial counts instead of inventing zero traffic.\nPausing retains storage reservations, and a row budget bounds aggregate capacity,\nnot PostgreSQL disk usage. Database maintenance remains necessary. The README\ncontains retention limits, implementation details and validation commands.<\/p>","slug":"mod_analytics","doc_module_config":[{"default":"1000000","description":"Maximum reserved group\/time slots across all retained recordings.","has_default":true,"key":"row_budget","module":"mod_analytics","type":"integer"},{"default":"false","description":"Only collect request events when analytics_consent is true in the request context.","has_default":true,"key":"require_consent","module":"mod_analytics","type":"boolean"}],"is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"0c211a65bbac1c95ea3016d1adb44da1cb5502bbef51aba6a841f462eafab7a1","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":"apps\/zotonic_mod_analytics\/src\/mod_analytics.erl","publication_start":"2026-11-09T11:26:19Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_analytics\/src\/mod_analytics.erl","pivot_location_lng":null,"doc_source_kind":"module","name":"doc_module_mod_analytics","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-11-09T11:26:19Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_analytics","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"2f7425ff448ef8fccc62544a9294970018b0cde7\n","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-11-30T14:47:19Z","title_slug":"mod_analytics"},"uri":"https:\/\/zotonic.com\/id\/3149","uri_template":"https:\/\/zotonic.com\/id\/:id","version":96,"websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3149"}},"status":"ok"}