> For the complete documentation index, see [llms.txt](https://consumer-trust-initiative.gitbook.io/consumer-trust-initiative-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://consumer-trust-initiative.gitbook.io/consumer-trust-initiative-docs/5.4-pseudocode-for-ux-score.md).

# 5.4 Pseudocode for UX Score

```
// def calculate_ux_score(site: SiteProfile) -> float:
    """Calculates the Pillar III (User Experience) score out of 10."""
    
    raw_score = 0
    max_score = 25

    # Design & Navigation (Max 10)
    # Assessed via a heuristic evaluation model (e.g., Nielsen's heuristics)
    raw_score += site.get_design_clarity_score() # 0-5
    raw_score += site.get_navigation_logic_score() # 0-5

    # Mobile Performance (Max 10)
    cwv_results = site.get_core_web_vitals()
    if cwv_results.passes_lcp and cwv_results.passes_inp and cwv_results.passes_cls:
        raw_score += 10
    elif cwv_results.passes_lcp: # Partial credit
        raw_score += 5

    # Search & Filtering (Max 5)
    if site.has_advanced_filtering():
        raw_score += 5

    # Normalize score
    normalized_score = (raw_score / max_score) * 10
    return round(normalized_score, 2)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://consumer-trust-initiative.gitbook.io/consumer-trust-initiative-docs/5.4-pseudocode-for-ux-score.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
