{"result":{"depiction_url":null,"edges":{"in_module":{"objects":[{"created":"2026-11-09T11:26:57Z","object_id":{"id":3149,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_analytics","title":"mod_analytics","uri":"https:\/\/zotonic.com\/id\/3149"},"seq":1}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"subject":{"objects":[{"created":"2026-11-09T11:26:13Z","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:13Z","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:13Z","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":3},{"created":"2026-11-09T11:26:13Z","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":4},{"created":"2026-11-09T11:26:13Z","object_id":{"id":2627,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_notification","title":"Notification","uri":"https:\/\/zotonic.com\/id\/2627"},"seq":5}],"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":19,"id":3148,"is_a":["text","documentation","reference","notification"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3148"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_notif_mod_analytics_analytics_events_829ef7875e812ce7925f9a38505bca63","page_url":{"en":"https:\/\/zotonic.com\/docs\/3148\/observe_analytics_events-notification-acc-context","x-default":"https:\/\/zotonic.com\/docs\/3148\/observe_analytics_events-notification-acc-context"},"preview_url":null,"resource":{"version":7,"pivot_location_lat":null,"title":"observe_analytics_events(Notification, Acc, Context)","is_authoritative":true,"body":"<p>Declare events that Site Analytics can record. This is a <code>foldl<\/code> notification,\nstarting with an empty list. Prepend your declarations to the accumulator and\nreturn the resulting list; preserve declarations from other observers.<\/p>\n<p>Include <code>zotonic_mod_analytics\/include\/analytics.hrl<\/code> to use <code>#analytics_events{}<\/code>.\nThe notification record has no fields. Enabled modules export this observer:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">observe_analytics_events(#analytics_events{}, Acc, _Context) -&gt;\n    [#{name =&gt; &lt;&lt;&quot;mod_newsletter:sent&quot;&gt;&gt;, version =&gt; 1,\n       title =&gt; &lt;&lt;&quot;Newsletter sent&quot;&gt;&gt;,\n       dimensions =&gt; #{&lt;&lt;&quot;kind&quot;&gt;&gt; =&gt; [&lt;&lt;&quot;digest&quot;&gt;&gt;, &lt;&lt;&quot;single&quot;&gt;&gt;],\n                       &lt;&lt;&quot;language&quot;&gt;&gt; =&gt; text}} | Acc].\n<\/code><\/pre>\n<p>Each declaration contains <code>name<\/code>, a namespaced binary of at most 100 bytes;\n<code>version<\/code>, a positive integer; <code>title<\/code>, a binary of at most 200 bytes; and\n<code>dimensions<\/code>, a map of at most eight fields. Dimension names are nonempty binaries\nof at most 40 bytes. A type is <code>text<\/code> or an enum of at most 100 nonempty UTF-8\nbinaries, each at most 255 bytes. Properties must match the declared schema.\nUse coarse categories, not personal data or free-form input. Fields named <code>ip<\/code>,\n<code>user_id<\/code>, <code>session_id<\/code> and <code>user_agent<\/code> are rejected. Only the first 64 module\ndeclarations are considered; duplicate names and invalid declarations are ignored.\nIncrement the version when the schema or meaning changes: existing recordings\nmust not silently start collecting a different event.<\/p>\n<p>After a successful domain operation, record a background event:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">m_analytics:record_event(&lt;&lt;&quot;mod_newsletter:sent&quot;&gt;&gt;,\n    #{&lt;&lt;&quot;kind&quot;&gt;&gt; =&gt; &lt;&lt;&quot;digest&quot;&gt;&gt;, &lt;&lt;&quot;language&quot;&gt;&gt; =&gt; &lt;&lt;&quot;en&quot;&gt;&gt;}, Context).\n<\/code><\/pre>\n<p>For a request-associated event, pass <code>z_context:get_reqdata(Context)<\/code> as the third\nargument to <code>record_event\/4<\/code>. Request exclusions and consent policy then apply;\nrequest dimensions declared in the schema are derived from the context and cannot\nbe overridden. The three-argument API does not implicitly associate a request.\nEvents are best-effort aggregate measurements, not durable audit records.<\/p>","slug":"observe_analytics_events-notification-acc-context","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"2fe720ccf2054798bd2a2d96b4a942c41aa6d65ec33374309890458350cc216b","is_featured":false,"notification":{"arity":3,"callbacks":[{"arity":3,"name":"observe_analytics_events","signature":"observe_analytics_events(Notification, Acc, Context)","variation":"observe"}],"name":"analytics_events","record":null},"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":1122,"is_a":["meta","category"],"name":"notification","title":"Notifications","uri":"https:\/\/test.zotonic.com\/id\/1122"},"doc_source_path":"apps\/zotonic_mod_analytics\/src\/behaviours\/zotonic_analytics_observer.erl","publication_start":"2026-11-09T11:26:13Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_analytics\/src\/behaviours\/zotonic_analytics_observer.erl","pivot_location_lng":null,"doc_source_kind":"notification","name":"doc_notif_mod_analytics_analytics_events_829ef7875e812ce7925f9a38505bca63","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-11-09T11:26:13Z","uri":null,"doc_status":"current","is_dependent":false,"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":"f3c6a9a2dde17cb5b121dd3e3018d9ef4b1b3943\n","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-11-09T21:39:18Z","title_slug":"observe_analytics_events-notification-acc-context"},"uri":"https:\/\/zotonic.com\/id\/3148","uri_template":"https:\/\/zotonic.com\/id\/:id","version":19,"websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3148"}},"status":"ok"}