Where each number comes from, and how fresh it is
A widget is only useful if you can explain it to the reader who asks “what is this number?”. What each line means is written under each widget above. This section adds where every number comes from and how often it changes. Nothing here is a secret: the widget script is plain, readable JavaScript, and you can open it in your browser and check each line against the table. First, what each source in the table means:
- Live price: a free public real-time feed that follows near-month COMEX gold futures, read by the visitor's browser.
- Live price × exchange rate: the live price times the day's reference exchange rate for the chosen currency.
- Live price vs its previous close: the live price compared with the same feed's previous trading-day close, which our site records from the feed when the market shuts at 5 pm New York time.
- Worked out in the widget: arithmetic inside the widget on the ounce price.
- Our COMEX futures data: our daily COMEX futures data file (a continuous front-month series).
- Visitor's clock: the visitor's own clock and the market's weekly timetable; no price data.
- Fixed text: words built into the widget.
| Line on the card | Source | How often it changes |
|---|
| Gold price today |
|---|
| Price per troy ounce | Live price × exchange rate | Price every 15 minutes; rate once a day |
| Day change | Live price vs its previous close | With the live price |
| Per gram 24K | Worked out in the widget | With the ounce price |
| Per gram 22K | Worked out in the widget | With the ounce price |
| Small print | Fixed text | Never |
| Updated (time) | Live price | On page open, then every 15 minutes |
| Is the gold market open now? |
|---|
| OPEN or CLOSED | Visitor's clock | Every second |
| Now | Visitor's clock | Every second |
| Closes in / Opens in | Visitor's clock | Every second |
| Closes / Opens (day and time) | Visitor's clock | Every second |
| Gold–silver ratio |
|---|
| The ratio | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Gold /oz (COMEX) | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Silver /oz | Our COMEX futures data | When our site republishes its data, normally several times a day |
| 1-year range bar | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Updated (time) | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Today's gold levels |
|---|
| Gold (COMEX futures) | Our COMEX futures data | When our site republishes its data, normally several times a day |
| R1, daily pivot, S1 | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Prior COMEX close | Our COMEX futures data | When our site republishes its data, normally several times a day |
| 20-day average | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Session of (date) | Our COMEX futures data | When our site republishes its data, normally several times a day |
| Gold rate by city |
|---|
| 24K per gram | Live price × exchange rate | Price every 15 minutes; rate once a day |
| 22K per gram | Worked out in the widget | With the ounce price |
| 10 grams 22K, or 1 tola 22K | Worked out in the widget | With the ounce price |
| 24K per troy ounce | Worked out in the widget | With the ounce price |
| Small print | Fixed text | Never |
| Updated (time) | Live price | On page open, then every 15 minutes |
The price label, in plain words
The gold price in the widgets is labelled COMEX gold futures, and that label is deliberate. The price shown follows near-month COMEX gold futures, which usually sit close to, and often a little above, the London spot price traders see quoted as XAUUSD; the two move together.
What that means for your readers:
- It is a live market price, not a shop price. It is the price of a gold futures contract traded on COMEX, the gold futures market run by CME Group in New York. Taxes, import duties, making charges and a dealer’s margin are not in it, which is why the gold price card and the city card both say so in small print.
- It can differ a little from the XAUUSD quote on a trading platform. A platform quotes its own price for spot gold (gold for delivery now). A futures contract is gold for delivery later, so it normally trades slightly above spot. The gap changes from day to day and is different for each contract month, so the widget does not print one. Our guide to the free gold price widget shows the gap measured on real days, and the lesson on the futures basis and the roll explains why it exists.
- It is an indicative price. It is good for showing roughly what gold costs right now and how far it has moved today. It is not a price anyone will deal at, and it should never be used to time an order.
Three kinds of time stamp
Look at the bottom-left corner of a widget. What it says tells you how fresh the numbers are.
- “Updated 21:06 GMT+1” (the time in the visitor’s own clock, with their time zone named; when the numbers are from an earlier day it shows only the date, for example “Updated 30 Nov”): the gold price card, the city card and the ratio card print this. On the gold price and city cards it is the time of the latest live price (or, if the live price could not be reached, the time of our last data refresh; the gold price card then says “last COMEX futures data” in its small print). On the ratio card it is the time of our last data refresh, because the ratio and its gold and silver prices come from our data file, not from the live price.
- “Cached 21:06 GMT+1” (or “Cached 30 Nov” from an earlier day): the visitor’s browser could reach neither our data file nor the live price, so the widget is showing the numbers saved into the script the last time our site was built. It is a warning label, not an error. As soon as the connection comes back, the widget returns to live numbers and the word changes back to “Updated”. The example times above are only to show the format: every visitor sees their own time and time zone.
- “Session of 2 Dec”: the levels card prints the trading session its levels belong to (with “(cached)” after it when it is showing saved numbers). For the first hours of a new session, until our data file adds the new session’s row, it can still show the previous session’s levels. The date tells you which ones you are looking at.
The market-open card is different again: its foot says “Gold market, Sun–Fri”, because it uses no price data at all. It works everything out from the visitor’s own clock and the market’s weekly timetable.
Two honest limits of the levels card
The levels card is the one widget where a reader can be misled if nobody explains it, so here are its two weak spots, with real numbers.
1. The levels come from the day before. Take the levels the card showed for the session of Wednesday 2 December 2026. They were built from Tuesday 1 December’s finished session of COMEX gold futures: high 3,704.2, low 3,613.1, close 3,627.7. The arithmetic is the classic floor-pivot formula:
- Daily pivot P = (3,704.2 + 3,613.1 + 3,627.7) ÷ 3 = 3,648.33
- R1 = 2 × 3,648.33 − 3,613.1 = 3,683.57
- S1 = 2 × 3,648.33 − 3,704.2 = 3,592.47
- Prior COMEX close = 3,627.70
Those are exactly the numbers the card drew in our browser test on 2 December. They are reference points many chart readers watch. They are not predictions and not signals, which is why the card carries the chip “Education, not signals”. Our lesson on pivot points in gold shows how traders use them and where they fail.
2. The futures series changes contract month a few times a year, and the averages feel it. Our daily data follows the front COMEX contract, and on 30 November 2026 it moved from the December 2026 contract to February 2027, which traded about $28 to $29 higher. The 20-day average on the same card (3,823.04 for the session of 2 December) was the mean of 18 December-contract closes and 2 February-contract closes. Worked out on February closes for all 20 days, it would have been 3,851.30, about $28 higher. So for about four weeks after a contract change, the 20-day average sits lower (or, after a change to a lower-priced month, higher) than the contract the levels now follow. The pivot, R1 and S1 are built from one session only, so they are clean again from the first full session on the new contract.
When the market is shut
CME Group’s contract page gives the trading hours of its main gold futures as Sunday to Friday, 6:00 pm to 5:00 pm New York time, with a 60-minute break each day from 5:00 pm. In practice that means the market opens on Sunday evening, pauses for one hour at 5:00 pm New York time on Monday to Thursday, and closes for the weekend at 5:00 pm on Friday. Outside those hours the main contracts do not trade, so the price in the widgets stops moving. A visitor on Saturday sees Friday’s last price and Friday’s change, which is correct. The market-open card shows “Weekend break” or “Daily pause” and counts down to the reopening. It does not know about exchange holidays, and it says so on its face (“Public holidays not included”). For holiday hours and the full weekly timetable in your own time zone, link your readers to the gold market hours tool.
Every setting the code understands
Each widget is set by a few words in its code. In the script code they are data- attributes. In the iframe code the same settings sit in the address after the ?, joined by &. The table below lists every setting the widget script reads. There are no others: colours, fonts, borders and labels cannot be changed from the code.
| Setting | Values | If missing or misspelt |
|---|
data-widget iframe: the address /embed/<name>/ every widget | gold-price, market-open, gold-silver-ratio, gold-levels, city-gold-rate | An unknown name shows the gold price card |
data-currency iframe: currency= gold price only | A three-letter code from the list below, in capitals or not | Missing or unknown: US dollars |
data-city iframe: city= city rate only | A city name from the list below, written as shown, in capitals or not | Missing or unknown: Dubai |
data-size iframe: size= (and set height="120") gold price only | card (300 × 250) or small (300 × 120) | Anything else: card. Ignored on the other widgets |
data-theme iframe: theme= every widget | dark or light | Anything else: dark |
We tested every row of that table in a real browser on 3 December 2026, including the mistakes. Three of the results are worth knowing before you edit a code by hand:
- A wrong value never breaks the widget, but it can quietly change it. A currency code the widget does not know (we tried
XYZ) shows US dollars. A city it does not know (we tried atlantis) shows Dubai. A theme other than light shows the dark theme. A widget name it does not know shows the gold price card. If your widget shows something you did not ask for, check the spelling first.
- Capital letters do not matter.
inr works like INR, and London like london.
- The small size exists only for the gold price card. On any other widget
data-size="small" is ignored and you get the normal card.
Here is a real example: the small gold price strip in Indian rupees, light theme, as the builder writes it.
<script src="https://www.xauusdglobal.com/assets/js/widget.js" data-widget="gold-price" data-currency="INR" data-size="small" data-theme="light" async></script>
<noscript><p style="font-size:12px;margin:4px 0 0">The live gold widget needs JavaScript.</p></noscript>
<p style="font-size:12px;margin:4px 0 0">Gold data by <a href="https://www.xauusdglobal.com/gold-price/india/" rel="nofollow noopener">XAUUSD Global</a></p>
And the levels card as an iframe, for a site builder that blocks scripts:
<iframe src="https://www.xauusdglobal.com/embed/gold-levels/?theme=dark" width="300" height="250" style="border:0;max-width:100%" loading="lazy" title="Today's gold levels widget"></iframe>
<p style="font-size:12px;margin:4px 0 0">Gold data by <a href="https://www.xauusdglobal.com/xauusd-analysis/" rel="nofollow noopener">XAUUSD Global</a></p>
Every currency and every city
The gold price card works in 65 currencies: the US dollar plus 64 others. The city card covers 55 cities in 21 countries and regions. These lists are produced from the same tables the widget script uses, so they always match what the widget accepts.
All 65 currency codes
| Code | Currency |
|---|
USD | US dollar |
INR | Indian rupee |
AED | UAE dirham |
SAR | Saudi riyal |
GBP | British pound |
EUR | euro |
NGN | Nigerian naira |
ZAR | South African rand |
MYR | Malaysian ringgit |
SGD | Singapore dollar |
AUD | Australian dollar |
CAD | Canadian dollar |
KES | Kenyan shilling |
PHP | Philippine peso |
IDR | Indonesian rupiah |
TRY | Turkish lira |
JPY | Japanese yen |
CNY | Chinese yuan |
QAR | Qatari riyal |
KWD | Kuwaiti dinar |
BHD | Bahraini dinar |
OMR | Omani rial |
EGP | Egyptian pound |
BDT | Bangladeshi taka |
LKR | Sri Lankan rupee |
NPR | Nepalese rupee |
THB | Thai baht |
VND | Vietnamese dong |
HKD | Hong Kong dollar |
KRW | South Korean won |
TWD | New Taiwan dollar |
GHS | Ghanaian cedi |
TZS | Tanzanian shilling |
UGX | Ugandan shilling |
MAD | Moroccan dirham |
CHF | Swiss franc |
MXN | Mexican peso |
BRL | Brazilian real |
NZD | New Zealand dollar |
PLN | Polish zloty |
SEK | Swedish krona |
ILS | Israeli new shekel |
MUR | Mauritian rupee |
TTD | Trinidad and Tobago dollar |
GYD | Guyanese dollar |
ZMW | Zambian kwacha |
JMD | Jamaican dollar |
CZK | Czech koruna |
HUF | Hungarian forint |
DKK | Danish krone |
NOK | Norwegian krone |
RON | Romanian leu |
UAH | Ukrainian hryvnia |
ZWG | ZiG (Zimbabwe Gold) |
ETB | Ethiopian birr |
NAD | Namibian dollar |
RWF | Rwandan franc |
IQD | Iraqi dinar |
JOD | Jordanian dinar |
COP | Colombian peso |
PEN | Peruvian sol |
ARS | Argentine peso |
CLP | Chilean peso |
KZT | Kazakhstani tenge |
UZS | Uzbek som |
All 55 cities, with the name to put in the code
| Country or region | Cities |
|---|
| UAE | Dubai (dubai), Abu Dhabi (abu-dhabi), Sharjah (sharjah) |
|---|
| Saudi Arabia | Riyadh (riyadh), Jeddah (jeddah), Dammam (dammam) |
|---|
| Qatar | Doha (doha) |
|---|
| India | Mumbai (mumbai), Delhi (delhi), Chennai (chennai), Bengaluru (bengaluru), Hyderabad (hyderabad), Kolkata (kolkata) |
|---|
| Singapore | Singapore (singapore) |
|---|
| Malaysia | Kuala Lumpur (kuala-lumpur), Johor Bahru (johor-bahru) |
|---|
| Indonesia | Jakarta (jakarta), Surabaya (surabaya) |
|---|
| Philippines | Manila (manila), Cebu (cebu) |
|---|
| Japan | Tokyo (tokyo), Osaka (osaka) |
|---|
| China | Shanghai (shanghai), Beijing (beijing) |
|---|
| Thailand | Bangkok (bangkok) |
|---|
| Hong Kong | Hong Kong (hong-kong) |
|---|
| Nigeria | Lagos (lagos), Abuja (abuja), Kano (kano) |
|---|
| Kenya | Nairobi (nairobi), Mombasa (mombasa) |
|---|
| South Africa | Johannesburg (johannesburg), Cape Town (cape-town), Durban (durban) |
|---|
| UK | London (london), Manchester (manchester), Birmingham (birmingham) |
|---|
| Eurozone | Frankfurt (frankfurt), Munich (munich), Paris (paris), Milan (milan), Amsterdam (amsterdam), Madrid (madrid) |
|---|
| Türkiye | Istanbul (istanbul), Ankara (ankara) |
|---|
| United States | New York (new-york), Los Angeles (los-angeles), Houston (houston), Chicago (chicago) |
|---|
| Canada | Toronto (toronto), Vancouver (vancouver), Montreal (montreal) |
|---|
| Australia | Sydney (sydney), Melbourne (melbourne), Perth (perth) |
|---|
The credit line under each code links to the gold price page for the currency or city you chose. The builder writes the right link for you. If you change the currency or city by hand, change the link too; a mismatch does no harm, it is just less useful to a reader who clicks it.
How wide and how tall: tested sizes
Both versions of every widget are designed for a 300-pixel-wide space, the usual width of a sidebar or a standard ad slot. Height is 250 pixels for the cards and 120 pixels for the small gold price strip.
The script version adjusts its width. It takes 300 pixels when there is room and shrinks to fit a narrower column. Its height stays fixed. We drew all 376 combinations (every currency in both sizes, every city, the other three widgets, both themes) at four column widths on 3 December 2026:
| Column width |
What happened |
| 300 px or more |
Everything fits, in every currency and city |
| 280 px |
Everything fits, except that the levels card’s title is shortened with “…” and, in time zones with a long name (for example GMT+5:30), the end of the time stamp can be cut |
| 260 px |
Two currencies with very long amounts (UGX and UZS) lose part of a line, and the market-open card’s foot is shortened |
| 240 px |
Long amounts in many currencies (for example IDR, KWD, AED) are cut, city names are shortened and the time stamp is cut on most cards |
So give the widget at least 280 pixels, and 300 if you use a currency with long amounts. Check your layout on a phone as well, because some themes add wide side margins.
The iframe version has a fixed height. It shows a page from our site inside a window. Its width shrinks with a narrow column in the same way (the code says max-width:100%), but its height is exactly the number in your code, and anything taller than the window is cut off with no scrollbar. In our test, an iframe of the levels card set to 200 pixels high lost the bottom 50 pixels: the 20-day average and the credit line. So keep height="250" for the cards and height="120" for the small strip, and if your site builder makes you draw the embed box by hand, draw it at least that big. The older iframe widgets further down this page are taller: 340, 360 and 400 pixels.
The theme is the card’s own colour, not your site’s. The dark theme is a near-black card with light text; the light theme is a white card with dark text. Pick the one that sits better on your page. The card has rounded corners and a thin border on both themes, so it reads as a separate box either way.
Adding the code to a site builder, a shop or a plain page
Every website system has a place that accepts raw HTML. The trick is to find it, because if you paste the code into a normal text box, your visitors will see the code as words instead of a widget. The names differ from one system to another, but they come in a few families:
- Block editors (the kind where you build a page from blocks): add a block called something like “Custom HTML”, “HTML” or “Code”, paste the script code into it, preview, then publish. For a sidebar or footer, look for a widget or section area that accepts the same kind of HTML block.
- Online shop themes: open the theme editor, add a section or block that accepts custom code (often called “Custom code” or “Custom HTML”), paste the code and save. To show the small price strip above a product list, add that section above the list.
- Drag-and-drop builders: these usually offer an “Embed” or “Embed HTML” element. Some of them place whatever you paste inside their own frame, so use the iframe code, then drag the element’s box to 300 × 250 (or 300 × 120 for the small strip) so no scrollbar appears.
- Blogging platforms with gadgets: add an “HTML/JavaScript” gadget or similar to a sidebar or footer, or switch a single post’s editor to its HTML view and paste the code there.
- A plain HTML page: paste the code anywhere inside the page’s
<body> and upload the page. There is nothing to install.
Two rules save most of the trouble. First, if the script code shows nothing, try the iframe code in the same place before anything else: some systems remove scripts, some only on their cheaper plans, and most of those still allow iframes. Second, check the published page, not only the editor: many editors do not run embedded code while you are editing.
If you want click-by-click steps with the real menu names of the most common website systems, our platform-by-platform guide has them.
You can put several widgets on one page. They share one data download, so the second widget costs almost nothing.
| What you see |
Most likely cause |
What to do |
| Nothing at all |
Your website system removed the script |
Use the iframe code in the same place |
| The code itself, as text on the page |
It went into a normal text or paragraph block |
Paste it into an HTML, code or embed block |
| An empty box in the editor, fine once published |
The editor does not run embedded code |
Check the published page |
| The bottom of the card is missing |
The iframe or embed box is shorter than the widget |
Set the height to 250 (120 for the small strip) |
| Long amounts or the time stamp end in “…” |
The column is narrower than about 300 pixels |
Give the widget a 300-pixel-wide space |
| Dubai, US dollars or the gold price card when you asked for something else |
A misspelt city, currency or widget name falls back to the default |
Copy a fresh code from the builder, or check the spelling against the lists above |
| “Cached” in front of the time |
The visitor’s browser could not reach our data or the live price |
Nothing; it switches back to live numbers by itself |
| The price differs from a trading platform’s XAUUSD |
The widget shows COMEX gold futures; the platform shows its own spot quote |
Expected; see “The price label, in plain words” above |
| Nothing, and your site sets a strict security policy |
A Content-Security-Policy that does not allow our domain |
Allow https://www.xauusdglobal.com for scripts, styles and data requests (script-src, style-src, connect-src); for the iframe, allow it in frame-src |
On that last row, two results from our own test with a strict policy (3 December 2026). If your policy allows our domain but not the outside live-price service, the widget still works: the gold price falls back to the latest COMEX futures price in our data file, and its small print changes to “Indicative price (last COMEX futures data)”. The live-price service’s address is written in the widget script, if you want to allow it as well. And if your policy blocks inline styles (no 'unsafe-inline' in style-src), everything draws except one detail: the marker on the ratio card’s range bar sits at the far left instead of at today’s value. Use the iframe code for that card, or allow inline styles.
Still stuck? Email info@xauusdglobal.com with the address of the page and the code you pasted.
Before you paste someone else’s code into your site, you should know what it does. Here it is, all of it.
What it downloads. The script file, under 9 KB once compressed for the trip, and a small style sheet. Then our data file, about 70 KB compressed, which the browser keeps for five minutes, and a tiny file of recent daily closing prices; every widget on the page shares both. Finally, one request to an outside, free, public live-price service for the latest gold price. The script loads with async, so your own page never waits for it, and the iframe code carries loading="lazy", which tells the browser not to load the frame until the visitor scrolls near it.
How often it asks again. Once when the page opens, then every 15 minutes while the page stays open. The market-open countdown ticks every second, but that uses the visitor’s own clock, not the network.
What it keeps. Nothing. The script sets no cookies, writes nothing to the browser’s storage and runs no analytics or tracking. Like any web request, the requests above reach our server and the live-price service with the visitor’s IP address. If your privacy notice lists the outside services your pages contact, add both.
What it can touch on your page. Only the one empty box it adds where you pasted the code. The script draws its widget inside a sealed box (what browsers call a shadow DOM): its styles cannot leak into your page, and your page’s styles do not reach inside it, because the widget sets its own font, colours and sizes. The iframe is a separate page by design.
Screen readers. Each script widget is marked as a labelled region (for example “Gold price today in USD”), the market-open badge is announced as a status, the levels card’s label includes “for education, not signals”, and the iframe code carries a title that says what the frame contains. Keep the title if you edit the code.
If our site is down. Your page still loads normally. The widget shows its last saved numbers marked “Cached”, or stays empty in the rare case that even the script file cannot be fetched.