The short version
- Open the free gold widgets page and use the builder to choose a widget, a currency or city, a size and the light or dark theme.
- Copy the one-line script code, or the iframe code if your platform blocks scripts.
- Paste it into your platform’s HTML or code box (the exact place for each platform is below) and publish.
That’s it. There’s no account, no API key and nothing to update later: prices, exchange rates and the market countdown refresh by themselves.
The five widgets, and what each is good for
| Widget | What it shows | Suits |
|---|---|---|
| Gold price today | Price per troy ounce and per gram (24K and 22K) in USD or 18 other currencies, 24h change, updated stamp | Jewellers, bullion and coin shops, finance blogs |
| Is the gold market open now? | Open or closed badge, current session, countdown to the next open or close in the reader’s own time zone | Trading blogs, education sites, communities |
| Gold–silver ratio | The ratio, gold and silver prices, and the 1-year range | Precious-metals newsletters, investing blogs |
| Today’s gold levels | Yesterday’s close, daily pivot, R1, S1 and the 20-day average, labelled “education, not signals” | Market commentary, trading education |
| Gold rate by city | 24K and 22K per gram for one city in local currency | Local jewellers, city and community sites |
Each one is 300 pixels wide, the standard width of a sidebar or an ad slot, and 250 pixels tall (the gold price widget also comes in a slim 300 × 120 size).
Script or iframe: which code should you use?
The builder gives you two codes for every configuration. They show exactly the same live data.
The script code is one line:
<script src="https://www.xauusdglobal.com/assets/js/widget.js" data-widget="gold-price" data-currency="INR" data-size="card" data-theme="light" async></script>
It draws the widget right where you paste it, fits narrow columns automatically, and keeps the credit link on your own page. The async attribute means it never holds up the rest of your page. Use it wherever your platform lets you add scripts: WordPress (self-hosted, or WordPress.com on a plan that allows custom code), Shopify, Blogger, Squarespace and plain HTML.
The iframe code is a small window onto our widget page:
<iframe src="https://www.xauusdglobal.com/embed/gold-price/?currency=INR&size=card&theme=light" width="300" height="250" style="border:0;max-width:100%" loading="lazy" title="Gold price today widget"></iframe>
<p style="font-size:12px;margin:4px 0 0">Gold price today in INR by <a href="https://www.xauusdglobal.com/gold-price/india/" rel="noopener">XAUUSD Global</a></p>
Use it on builders that strip or sandbox scripts, such as Wix and Google Sites, and in email-style editors that only accept iframes. Keep the short credit paragraph under it.
You can change the options by hand too: data-currency (or currency= in the iframe address) takes a code such as USD, INR, AED, SAR, GBP, EUR, PKR, NGN or MYR; data-theme is dark or light; data-size is card or small for the gold price widget; and the city widget takes data-city, for example mumbai, dubai or lagos.
WordPress
Block editor (Gutenberg)
- Open the page or post and click where the widget should go.
- Click the + (block inserter), search for Custom HTML and add the block.
- Paste the script code.
- Click Preview in the block toolbar to see it, then Update or Publish.
Sidebar or footer
- Go to Appearance → Widgets (or Appearance → Customize → Widgets on some themes).
- Add a Custom HTML block or widget to the sidebar or footer area.
- Paste the code and save. The widget now appears on every page that shows that sidebar.
Page builders
In Elementor, drag the HTML widget onto the page and paste the code. In Divi, use a Code module. Most other builders have an “HTML” or “Code” element that works the same way.
On WordPress.com, the free and lower plans remove scripts from posts. If the script does not show, use the iframe code in a Custom HTML block instead.
Shopify
Online Store 2.0 themes (Dawn and most current themes) have a section made for this.
- In your Shopify admin go to Online Store → Themes and click Customize on your live theme.
- Open the page template where the widget should appear, for example the home page or a collection page.
- Click Add section and choose Custom Liquid.
- Paste the script code into the Liquid box. Shopify accepts plain HTML and scripts here.
- Drag the section into place and click Save.
For a coin or bullion store, the small 300 × 120 gold price widget above your product grid works well; set data-currency to your store’s currency. On older themes without Custom Liquid, add a Custom HTML block, or paste the code into a page using the Show HTML (<>) button in the page editor.
Wix
Wix runs custom code inside its own frame, so the iframe code gives the most predictable result.
- In the Wix editor click Add Elements (the +), then Embed Code → Embed HTML.
- In the box that appears, choose Code, paste the iframe code and click Update.
- Drag the corners until the box is 300 × 250 pixels (or 300 × 120 for the small gold price widget), so there is no scrollbar.
- Publish and check the live page. The editor preview is sometimes blank even when the published page is fine.
Blogger
- In your Blogger dashboard go to Layout.
- In the sidebar or footer, click Add a Gadget and choose HTML/JavaScript.
- Leave the title empty (the widget has its own), paste the script code and click Save.
- Click Save arrangement if your template asks for it, then view the blog.
To put a widget inside a single post instead, open the post, switch the editor from Compose view to HTML view, paste the code where you want it and publish.
Squarespace
- Edit the page and click an insert point (+ or Add block).
- Choose Code.
- Paste the script code and make sure the display is set to HTML, with “Display source” switched off.
- Click outside the block, then Save and check the live page.
Squarespace runs scripts in Code blocks only on some plans, and its editor often hides script output while you edit. If the widget does not appear on the published page, paste the iframe code into the Code block instead.
Plain HTML
Paste the script code into your page’s <body> wherever the widget should appear, then upload the file:
<aside class="sidebar">
<h2>Gold today</h2>
<script src="https://www.xauusdglobal.com/assets/js/widget.js" data-widget="market-open" data-theme="dark" async></script>
</aside>
You can paste several widgets on one page; they share a single data download. Each script line draws its own widget where it sits.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
| Nothing appears | The platform strips scripts | Use the iframe code instead |
| The code shows up as text | Pasted into a normal text or paragraph block | Use a Custom HTML, Code, Custom Liquid or Embed block |
| Scrollbar inside the iframe | Box smaller than the widget | Set the iframe or Wix box to 300 × 250 (or 300 × 120) |
| Blank in the editor, fine when published | The editor doesn’t run embeds | Check the published page |
| Wrong currency | data-currency missing or misspelled |
Use a three-letter code such as INR or AED |
| “Cached” next to the time | Your network blocked the live data | The widget shows the last snapshot; it switches back to live data automatically |
What the widgets do not do
The numbers are indicative: the price is converted from COMEX gold futures at market exchange rates, and shops add VAT or GST, making charges and their margin, so a jeweller’s board will differ. The levels widget shows reference points from yesterday’s prices for education. None of the widgets gives buy or sell signals. For the background behind each number, see our gold price by country pages, the gold market hours tool, the gold-silver ratio tracker and our daily XAUUSD analysis. If you only need the earlier iframe widgets, the original widget guide still applies.
Key takeaways
- Build your widget and copy the code on the free gold widgets page.
- Use the one-line script on WordPress, Shopify, Blogger, Squarespace and plain HTML; use the iframe on Wix and anywhere scripts are blocked.
- Paste into a Custom HTML, Custom Liquid, HTML/JavaScript or Code block, never a plain text block.
- Keep the “Gold data by XAUUSD Global” credit visible: it’s the only thing we ask for.
Sources
- XAUUSD Global: Free gold widgets and embed codes
- WordPress.org: Custom HTML block
- Shopify Help Center: Sections and blocks
- Wix Help Center: Embedding custom code
- MDN Web Docs: The iframe element
Educational content only, not financial advice. Trading gold with leverage carries a high risk of loss.
Frequently asked questions
How do I add a live gold price to my WordPress site?
Open the free gold widgets page, choose the gold price widget and your currency, and copy the script code. In the WordPress block editor add a Custom HTML block, paste the code, preview and publish. For a sidebar, paste the same code into a Custom HTML widget under Appearance, Widgets.
Can I show the gold price on a Shopify store?
Yes. In Shopify go to Online Store, Themes, Customize, add a Custom Liquid section (available in Online Store 2.0 themes such as Dawn) where you want the widget, paste the script code and save. The small 300 by 120 size suits a strip above coin and bullion listings.
Why does the widget not appear on my Wix site?
Wix places custom code in its own frame, so use the iframe version: Add Elements, Embed Code, Embed HTML, choose Code, paste the iframe code, then resize the box to 300 by 250 pixels (or 300 by 120 for the small gold price widget) and publish. Wix editor previews sometimes stay blank; check the published page.
Is the gold widget code safe to paste into my site?
Yes. The script is a single small file with no libraries, sets no cookies, does no tracking and only draws the widget inside its own isolated box (shadow DOM), so it cannot change your page’s styles. If you prefer full isolation, the iframe version runs in a separate frame.
Do I have to keep the 'Gold data by XAUUSD Global' line?
Yes, that credit line is the only thing we ask for in return for the free, maintained data. Keep it visible and linked, without nofollow or hiding it. You can still choose the size and the light or dark theme.