Sub topic 13
Update frequency and data freshness
This chapter assumes you can read RSS/XML and JSON, you know how a product catalog maps to SKUs, and you have already built a basic feed with the core attributes from earlier chapters. It covers how stale data causes errors, how often to refresh, and how to keep the feed, the page, and the structured data aligned over time.
Why freshness matters
A feed is a snapshot. Shopping systems read that snapshot and may show it to a shopper minutes or days later. When the snapshot no longer matches the store, three things go wrong:
- A shopper sees a price or stock status that the product page contradicts.
- The system detects the mismatch and limits or disapproves the item.
- An AI answer that quoted the old price or availability now looks wrong, and the shopper loses trust in your listing.
Price and availability change most often, so they carry most of the freshness risk. Titles, descriptions, and identifiers change rarely, and a daily refresh is usually enough for them.
Which attributes go stale fastest
| Attribute | How fast it changes | Typical risk if stale |
|---|---|---|
| availability | Minutes to hours | Shopper clicks an item that is sold out |
| price, sale_price | Hours to days | Price mismatch with the landing page |
| sale_price_effective_date | Set in advance | Sale shown after it ended, or not shown at start |
| shipping, returns | Weeks to months | Wrong delivery promise or cost |
| title, description, image_link | Weeks to months | Outdated copy or broken image URL |
| gtin, brand, item_group_id | Rarely | Wrong matching after a product change |
Use this table to decide what must be refreshed often and what can wait.
Fetch schedules and push updates
Merchant Center-style systems accept data in two broad ways. The details differ by platform, so check the current documentation for your account.
- Scheduled fetch. You host the file at a stable URL. The platform downloads it at a time you configure, usually once per day or more often. This is simple, but the interval sets the worst-case delay between a change in your store and the change in the listing.
- Push through an API or file upload. Your system sends product changes when they happen. This supports near-real-time updates for price and stock, and it needs more engineering.
A common design combines both. A scheduled full-file fetch acts as the baseline and repairs drift. Smaller incremental updates for price and availability go out through the API as the changes occur.
Choosing a refresh interval
Pick the interval from how fast your data changes and how costly a mismatch is, not from a fixed rule.
- Stable catalog, few price changes: one fetch per day is often enough.
- Fast-moving stock or frequent promotions: fetch more often, or push availability and price updates as they occur.
- Limited inventory (for example, one-off items): treat availability as near-real-time, because a sold item that stays listed creates a bad experience immediately.
Also account for processing time. After a fetch or upload, the platform needs time to read the file and apply changes. The delay between your change and a visible listing change is the fetch interval plus processing time. Measure it for your account instead of assuming it.
Scheduling sales with effective dates
For planned promotions, do not rely on swapping the price at the exact start time. Give the system the dates in advance with sale_price_effective_date. The value is a start and end timestamp in ISO 8601 format, separated by a slash. Include a timezone offset so the sale starts and ends when you expect.
<g:price>89.00 USD</g:price>
<g:sale_price>69.00 USD</g:sale_price>
<g:sale_price_effective_date>2026-12-01T00:00-0500/2026-12-07T23:59-0500</g:sale_price_effective_date>The landing page and the JSON-LD must follow the same schedule. If the feed says the sale ends on 7 December but the page keeps the low price, the page and feed disagree after that date. Build the page price and the feed price from the same source of truth so both change together.
Keeping the page and markup in step
Freshness has three layers, and each must update together:
- The feed or API data in the merchant account.
- The visible price and stock status on the landing page.
- The JSON-LD
Offeron that page.
The most common freshness bug is a page that is cached longer than the feed interval. The feed updates at noon, but a content delivery network (CDN) serves the old page until evening. The checker then sees the old price on the page and the new price in the feed. Align your cache lifetime for product pages with your feed interval, or purge the cache for a product when its price or stock changes.
Another common bug is JSON-LD that is rendered once at build time. If your site is statically generated, the markup keeps the build-time price while the live price comes from an API. Render the Offer from the same data that renders the visible price.
{
"@context": "https://schema.org",
"@type": "Offer",
"url": "https://www.example.com/p/trail-runner-jacket?color=blue&size=m",
"priceCurrency": "USD",
"price": "69.00",
"priceValidUntil": "2026-12-07",
"availability": "https://schema.org/InStock"
}priceValidUntil tells consumers when the price stops applying. If you set it, update or remove it when the date passes. An expired date on a live page is itself a stale-data signal.
Detecting staleness in your own pipeline
Do not wait for a disapproval to learn that data is stale. Add two cheap checks to your pipeline.
First, check the age of the feed file. The script below reads the lastBuildDate field of an RSS channel, or falls back to the file's modification time, and fails when the feed is older than a limit.
import sys
import time
import os
import xml.etree.ElementTree as ET
from email.utils import parsedate_to_datetime
def feed_age_hours(path):
root = ET.parse(path).getroot()
node = root.find("./channel/lastBuildDate")
if node is not None and node.text:
built = parsedate_to_datetime(node.text.strip()).timestamp()
else:
built = os.path.getmtime(path)
return (time.time() - built) / 3600
def main(path, max_hours):
age = feed_age_hours(path)
print("feed age: %.1f hours (limit %.1f)" % (age, max_hours))
return 1 if age > max_hours else 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1], float(sys.argv[2])))Run it as python feed_age.py feed.xml 24. It exits with 1 when the feed is older than 24 hours, which lets a scheduler or CI job raise an alert.
Second, spot-check live pages. Sample a few products, fetch each page, and compare its price and availability with the feed. Run this after each feed build and after each deployment. Differences point to caching, rendering, or sync problems.
Common errors
- Setting the fetch schedule but forgetting the file build. The platform fetches on time, but the file at the URL was last generated three days ago. Monitor the file's age, not only the fetch status.
- Fetch failures that go unnoticed. If the URL returns an error or requires a login, the platform keeps the previous data. Listings look fine until they are badly out of date. Alert on fetch errors.
- Timezone mistakes in sale dates. A missing offset can shift a sale by hours. Always include the offset.
- Updating availability in the feed but not on the page. Both must change together.
- Full-file rewrites that change item ids. Changing
idmakes the system treat items as new products and can discard their history. Keep ids stable.
Summary of the working model
Freshness is the time from a store change to a visible listing change. It is the sum of when your system writes the file, when the platform fetches it, how long processing takes, and how long caches delay the page. Shorten the slowest part first, and keep the feed, page, and markup tied to one source of truth.
Exercise
Your feed is fetched every 24 hours and your product pages are cached by a CDN for 48 hours. A price drops at 09:00. Name two places where a shopper or checker could see the old price, and one change that fixes it.
Show answer
The old price can appear in the listing (the feed is not refetched until the next daily fetch) and on the landing page and its JSON-LD (the CDN serves the cached page for up to 48 hours). The page and feed also disagree during the gap, which can cause a price mismatch. Fix it by purging the CDN cache for the product when the price changes and pushing the price through an incremental API update, or at least by making the page cache lifetime no longer than the feed interval.
Exercise
Why is a successful scheduled fetch not proof that your listings are fresh, and what check would catch the problem?
Show answer
A successful fetch only shows that the platform downloaded the file. If the file was generated days ago, it still holds old prices and stock. Check the age of the feed file, using lastBuildDate or the modification time, and alert when it exceeds your limit, for example 24 hours.