Proposal: Tracker And Visit

Currently we have a concept of ud cookie, which internally stores currently logged in user’s ID, and session id.

Realm itself doesn’t know what those IDs represent, it treats them as opaque strings. This is after we implement activity store. Currently we only know of ud cookie.

What is user id? Its the id you want to use to represent your user. Depending on your website you will have auto incrementing primary key as id, a guid, or maybe even the username.

Similarly, if a user is logged in on multiple devices, it would be good to keep each activity grouped by the device. For identifying the device we can use user-agent etc, but they are no unique, so simplest thing is to drop a session id. Session represents a login/logout session, is created when user logs in, is destroyed when user logs out.

What is a visit? When a visitor on your site visits, say I am a logged in user, or maybe anonymous user, and came today at 8AM, and was on site for next 15 minutes, browsing around, whatever, this is one visit. If I keep coming within 30 mins, it will keep extending the visit. But if I drop off for 30 mins, say come back again at 9AM, this would be considered second visit.

What realm will do as part of this proposal is to generate a unique id (guid maybe), and set it as visit_id cookie in browser, with an expiry of 30 mins. If any http request comes with that cookie, meaning the cookie did not expire, the expiry of cookie is set to now + 30 mins on every request.

The value of visit would be available in activity.

What is tracker? Purpose of tracker is to uniquely identify the browser. Say you made 10 visits from a device before you signed up, it would be good to know this.

Realm will generate a unique id, and set it as tracker_id cookie, with infinite life. The value of this cookie would be available in activity.

We’ll generate and set these cookies if not present (honouring visit expiry), and log them as part of activity logging.

But isn’t tracking users bad?

Realm is extremely privacy concerned. And this tracking, is done as a step to improve privacy consideration.

First of all these features can be switched off in realm by setting an environment variable (REALM_DONT_TRACK=1).

Further, if we do not have a privacy protecting solution to answer simple questions eg how many people visited my site today etc, people will resort to analytics companies, who are extremely privacy invasive.

Table Of Content

What is Realm?

A Bit On Motivation

Routing is Hard

What does Realm do?

Backend Data And Type Safety


Quick Start Realm Tutorial

In Depth Tutorial (not ready)

Hello Rust
Hello Elm
Hello Static Files
Hello Server Side Rendering
Pre-Commit Hooks

Routing, Request And Response

Frontend, Data, Navigation, And APIs

How To Guides

File Upload

Backend: S3 File Upload
Authenticated File Serving
Frontend: Uploading Files From Elm

How to use storybook?

How to implement “loading..”?









Environment Variables

Internals - Only for Realm Developers, not Users

“Realm DATA”
iFrame Controller
Shutdown Routine
Testing Internals

Change Log

Get Realm Starter Working

Transparent Offline Feature

How to make http requests in Realm?


Replay Testing

Tutorial: ToDo App

Realm Testing

Enhance Realm Starter

Double Load Issue

Deploy To Heroku Button

End failure

Realm-Starter Github Template

Proposal: Tracker And Visit

Proposal: Activity Store

Proposal: Bundling

Proposal: Retry On Network Error

Storybook: Editable JSON

Storybook: Notes

Storybook: Reference



Change Log

How to Publish


Code Snippets

Skip rustfmt For Some Section

Close Modal Dialog When Clicked Outside

Ignoring Lints In Python

Ignoring Lints (clippy and rustc warnings) In Rust

Handle DateTime in Rust & Elm

Handle CiText value read in Rust

Transport Enum Type to and fro Rust/Elm through JSON