Introducing a new way to review your PRs.

Read the announcement

frappe / builder

Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly

View on GitHub

20 documents · Updated Nov 23, 2026

docs / builder-access-and-analytics

Builder access and analytics

Builder uses server-side permissions to control who can enter and change the authoring space. It adds site and editor read-only states for safe maintenance and preview work. It also records authoring activity and published-site behavior so teams can understand use without mixing product telemetry with visitor analytics. See the Builder server domain, Builder content documents, Server API and events, Website rendering and publishing, Content import, export, and setup, and Site configuration and design tokens pages for the neighboring systems.

Access boundaries

Builder has two access boundaries. The first protects entry to the authoring space. The second protects each server action that reads or changes Builder data. This keeps the client display from being the only access check.

Session context

The session context identifies the signed-in user and gives the Builder client the site state needed to start safely. The server boot data includes the site name, CSRF token, Builder version, deployment flags, and the initial site read-only flag. The client reads the current user from the Frappe session cookie and checks write permission on Builder Page before it allows the main Builder routes to open (frontend/…/router.ts• L6-55).

Server actions then apply their own read or write check through has_page_read or has_page_write. A read check permits observation such as analytics. A write check protects page changes and other authoring actions (builder/utils.py• L71-104, builder/api.py• L599-655). The server remains the authority when a user reaches an action by a direct request.

References: frontend/…/router.ts• L6-55 builder/…/_builder.py• L12-26 builder/utils.py• L71-104 builder/api.py• L599-655

Invitation flow

The Users settings area gives managers one place to see Builder members and pending invitations. An invitation uses the Website Manager role and the Builder app name, so an accepted invitation grants the role that the Builder access model recognizes (frontend/…/GlobalUsers.vue• L73-139).

The flow reports four useful outcomes: a new invitation, an existing pending invitation, an already accepted invitation, or a disabled account. Managers can resend or cancel pending invitations. The member list shows enabled system users with either Website Manager or System Manager; System Managers are marked as admins (builder/api.py• L352-392). Frappe limits who may send these Builder invitations through the configured invitation roles (builder/hooks.py• L100-106).

sequenceDiagram
    participant M as Builder manager
    participant U as Users settings
    participant S as Frappe invitation service
    participant R as Invited user

    M->>U: Enter email addresses
    U->>S: Send Builder invitation
    S-->>U: New, pending, member, or disabled result
    R->>S: Accept invitation
    S-->>U: Builder membership becomes visible

References: frontend/…/GlobalUsers.vue• L11-69 frontend/…/GlobalUsers.vue• L167-214 builder/api.py• L352-392 builder/hooks.py• L100-123 builder/user_invitation.py• L6-13

Presence context

Presence shows who is viewing the same Builder Page. It is a collaboration aid rather than a permission grant. The page subscription receives the viewer list, removes the current user, and resolves the remaining users into names and images for the avatar display (frontend/…/PageBuilder.vue• L250-309).

The user lookup returns placeholder data first, then fills it from one short batch request. A session cache and request grouping stop repeated viewer lists from creating one request per avatar (frontend/…/usersInfo.ts• L24-82). If the lookup cannot return a profile, the UI can still show the user identity it already has. The toolbar shows each viewer as an avatar or an initial and summarizes the viewer names in the tooltip, so presence remains useful when several people view one page (frontend/…/ViewerAvatars.vue• L1-43).

References: frontend/…/PageBuilder.vue• L250-309 frontend/…/usersInfo.ts• L24-82 frontend/…/ViewerAvatars.vue• L1-43

Authoring availability

Builder separates a site maintenance lock from an editor lock. This distinction lets the system stop writes during a site update while still giving the user a clear reason, and lets the editor show a historical or otherwise non-editable view without changing the site permission model.

Read-only state

The site read-only state comes from the server maintenance flag. The Builder boot page passes the first value to the client, and the is_site_read_only endpoint lets the client check it again. When the flag is on, Builder shows a persistent warning and polls every ten seconds. When the site becomes writable, it dismisses the warning, confirms that editing can continue, and saves the selected page on the next client tick (frontend/…/useSiteReadOnlyNotice.ts• L7-61, builder/api.py• L27-35).

The editor read-only state is separate. It blocks canvas input and page autosave, while the site state describes the whole site during a maintenance or migration window (frontend/…/builderStore.ts• L47-53, frontend/…/PageBuilder.vue• L325-347). The toolbar labels a template page as Template and other non-editable pages as Read Only. For a template, an authorized user can create an editable copy without changing the source template (frontend/…/ReadOnlyBadge.vue• L1-37). A permission failure and a maintenance lock therefore have different causes and different user messages.

flowchart TD
    A[Builder starts] --> B[Read site state]
    B -->|Writable| C[Allow normal authoring]
    B -->|Read-only| D[Show persistent notice]
    D --> E[Poll site state]
    E -->|Still read-only| D
    E -->|Writable again| F[Dismiss notice and resume editing]

References: builder/…/_builder.py• L12-26 builder/api.py• L27-35 frontend/…/useSiteReadOnlyNotice.ts• L7-61 frontend/…/builderStore.ts• L47-53 frontend/…/PageBuilder.vue• L325-347 frontend/…/ReadOnlyBadge.vue• L1-37

Design tokens

Builder Tokens are shared design values, not login credentials. They give authorized Builder users named values for color, dimension, and font choices. A token can also provide a dark-mode value, which lets the same content adapt to the active theme (builder/…/builder_token.json• L14-55).

Token access follows the Builder data model. System Managers and Website Managers can manage Builder Token records. The server turns saved values into CSS variables for Builder and published rendering, so token values affect downstream page appearance (builder/…/builder_token.json• L67-86, builder/…/builder_token.py• L84-120). Changes clear the token cache and the rendered token asset cache so later views use the new values (builder/…/builder_token.py• L39-58, builder/…/builder_token.py• L123-127).

References: builder/…/builder_token.json• L14-55 builder/…/builder_token.json• L67-86 builder/…/builder_token.py• L39-58 builder/…/builder_token.py• L84-127 frontend/…/builderToken.ts• L1-12 frontend/…/useBuilderToken.ts• L23-43

Analytics observation

Builder has two analytics paths with different subjects. Builder telemetry observes how people use the authoring product. Website analytics observes visits and clicks on published pages. Keeping these paths separate makes access rules and data meaning easier to reason about.

Telemetry events

The Builder client installs telemetry with app_name: "builder". It records product events around page entry, templates, components, assets, scripts, homepage changes, and previews. These events describe authoring activity at a feature level rather than acting as a permission check (frontend/…/main.ts• L21-25, frontend/…/TemplateGallery.vue• L159-232, frontend/…/useCanvasDropZone.ts• L215-300).

The server also records Builder-specific invitation events when an invitation is created or accepted. The active-site event is recorded for signed-in visits to the Builder shell. These signals help measure access and adoption across the full path from entering Builder to inviting another author (builder/user_invitation.py• L6-13, builder/…/_builder.py• L12-26).

References: frontend/…/main.ts• L21-25 frontend/…/TemplateGallery.vue• L159-232 frontend/…/useCanvasDropZone.ts• L215-300 builder/user_invitation.py• L6-13 builder/…/_builder.py• L12-26

Website analytics

Website analytics uses Frappe page-view tracking as its visit source and adds click records for published Builder pages. Click capture is allowed for visitors, runs only when tracking is enabled, accepts the page element and its text, and uses the page path from the same-site referrer so clicks can join page views (builder/api.py• L658-696).

Every ten minutes, scheduled jobs move new view and click records into the site's analytics store. The Builder dashboard can then request page or site results by date and route. It shows total and unique views, time-series data, top pages, referrers, and click-through rate by page element (builder/hooks.py• L126-135, builder/builder_analytics.py• L181-186, builder/builder_analytics.py• L258-380, builder/builder_analytics.py• L398-467).

Analytics reads require Builder Page read permission. The client supplies date, interval, route, and route-filter choices to the page and site analytics panes. Selecting a chart point narrows the date range to the next useful time unit (builder/api.py• L606-655, frontend/…/useAnalytics.ts• L52-84, frontend/…/useAnalytics.ts• L278-365).

flowchart LR
    V[Published page visit] --> P[Page view record]
    V --> C[Published-page click record]
    P --> I[Scheduled ingestion]
    C --> I
    I --> D[Analytics data]
    D --> Q[Permission-checked dashboard query]
    Q --> R[Views, referrers, pages, and CTR]

References: builder/api.py• L606-655 builder/api.py• L658-696 builder/hooks.py• L126-135 builder/builder_analytics.py• L181-186 builder/builder_analytics.py• L258-380 builder/builder_analytics.py• L398-467 frontend/…/useAnalytics.ts• L52-84 frontend/…/useAnalytics.ts• L278-411

Change checklist

When these files or sections are changed, remember to consider these:

  • Permission roles or Builder routes: keep the route entry check, server read/write decorators, and invitation role rules aligned.
  • Site read-only behavior: keep the boot flag, status endpoint, polling notice, editor write guards, template-copy action, and resume-save behavior consistent.
  • Viewer payloads: keep the realtime viewer event, current-user filtering, profile lookup shape, and avatar or tooltip display aligned.
  • Builder Token fields or output: update the DocType, client token resource, CSS generation, cache clearing, and published rendering contract together.
  • Analytics fields or event names: update telemetry capture sites, invitation hooks, ingestion fields, API responses, and dashboard expectations as one contract.

Important failure modes

TriggerConsequenceGuard
The user lacks write permission on Builder PageBuilder routes deny entry and send the user to the app or login page.The router checks permission before route entry, and server methods check permission again.
The site enters maintenance read-only modeEditing and autosave stop while the warning stays visible.The client polls is_site_read_only and resumes only after the server reports writable state.
A template page has no valid template groupThe user cannot use the toolbar action to create an editable copy.The duplicate action is shown only when the active page has a template group.
An invite targets a pending, accepted, or disabled accountNo new membership is created for that address.The invitation response labels each state so the manager can resend, wait, or correct the account.
Website view tracking is disabledPublished-page clicks are ignored, so later analytics cannot show those events.Click capture checks the shared tracking setting before inserting a record.
Analytics has no valid date range or its data store query failsThe dashboard receives zero counts and empty result lists.The client sends a date range, while the analytics service returns a safe empty result on query failure.

Key files

FileWhy to read it
frontend/…/router.tsShows how login state and Builder Page write permission control entry to the authoring space.
builder/utils.pyDefines the shared server-side read and write permission boundary.
frontend/…/GlobalUsers.vueShows the manager-facing member and invitation flow.
builder/api.pyConnects site state, member data, invitation data, analytics access, and published-page click capture to server APIs.
frontend/…/useSiteReadOnlyNotice.tsExplains the maintenance notice, polling, and recovery behavior.
frontend/…/PageBuilder.vueShows page presence and the conditions that prevent autosave during read-only authoring.
frontend/…/ReadOnlyBadge.vueShows the distinction between template and read-only pages and the path to create an editable copy.
frontend/…/ViewerAvatars.vueShows how the toolbar presents the names and fallback identities of current viewers.
builder/…/builder_token.pyShows how shared design values reach CSS and how their caches stay current.
frontend/…/useAnalytics.tsDefines the common dashboard query model and date or route filtering behavior.
builder/builder_analytics.pyDefines the published-site metrics and the view, referrer, and click-through results.
builder/user_invitation.pyRecords Builder invitation lifecycle events for telemetry.