# Dynamic LCP Priority: Learning from Past Visits

DevFeed: [Dynamic LCP Priority: Learning from Past Visits](<https://devfeed.tech/articles/dynamic-lcp-priority-learning-from-past-visits-29499.md>)

Original publisher: [Read original article](<https://philipwalton.com/articles/dynamic-lcp-priority/>)

Published: 2022-12-28T20:43:44Z

Content type: tutorial

Language: en

Sources: [Philip Walton](<https://devfeed.tech/sources/philip-walton.md>)

Topics: [Chrome](<https://devfeed.tech/topics/chrome.md>), [Workers](<https://devfeed.tech/topics/workers.md>), [API](<https://devfeed.tech/topics/api.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [browser](<https://devfeed.tech/tags/browser.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [cloudflare-workers](<https://devfeed.tech/tags/cloudflare-workers.md>), [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [javascript](<https://devfeed.tech/tags/javascript.md>)

## AI overview

This tutorial explains how to dynamically set LCP priority on complex or personalized pages when the LCP element cannot be known in advance. It describes collecting LCP data from previous visitors, storing it, and using that data on later requests, with an implementation based on Cloudflare Workers, Worker KV, and the Worker HTMLRewriter API.

## Source excerpt

Earlier this year, Chrome shipped the new Priority Hints API, which lets developers inform the browser which resources are the most important, such as the LCP image. There's just one small problem