const API_KEY = 'YOUR_API_KEY'; // <- Replace this with your real API Key const API_URL = `https://api.metals.dev/v1/latest?api_key=${API_KEY}&base=USD&symbols=XAU`; async function updateGoldTicker() { try { const response = await fetch(API_URL); const data = await response.json(); const goldPriceUSD = data?.rates?.XAU; if (goldPriceUSD) { const goldPriceGBP = (goldPriceUSD * 0.80); // Rough USD to GBP const tickerText = `Live Gold Price: £${goldPriceGBP.toFixed(2)} GBP | Updated every minute | exgold.co.uk ✨`; document.getElementById('gold-ticker-text').innerText = tickerText; } else { document.getElementById('gold-ticker-text').innerText = 'Gold price unavailable at the moment.'; } } catch (error) { console.error('Error fetching gold price:', error); document.getElementById('gold-ticker-text').innerText = 'Error fetching gold price.'; } } // Initial fetch updateGoldTicker(); // Refresh every 60 seconds setInterval(updateGoldTicker, 60000); const API_KEY = 'YOUR_API_KEY'; // <- Replace this with your real API Key const API_URL = `https://api.metals.dev/v1/latest?api_key=${API_KEY}&base=USD&symbols=XAU`; async function updateGoldTicker() { try { const response = await fetch(API_URL); const data = await response.json(); const goldPriceUSD = data?.rates?.XAU; if (goldPriceUSD) { const goldPriceGBP = (goldPriceUSD * 0.80); // Rough USD to GBP const tickerText = `Live Gold Price: £${goldPriceGBP.toFixed(2)} GBP | Updated every minute | exgold.co.uk ✨`; document.getElementById('gold-ticker-text').innerText = tickerText; } else { document.getElementById('gold-ticker-text').innerText = 'Gold price unavailable at the moment.'; } } catch (error) { console.error('Error fetching gold price:', error); document.getElementById('gold-ticker-text').innerText = 'Error fetching gold price.'; } } // Initial fetch updateGoldTicker(); // Refresh every 60 seconds setInterval(updateGoldTicker, 60000); position:fixed; bottom:0;
top of page
I'm a product description. I'm a great place to add more details about your product such as sizing, material, care instructions and cleaning instructions.

Mother day Gold coin 150 grams

SKU: 36523641234523
£17,000.00Price
Quantity
  • I'm a product detail. I'm a great place to add more information about your product such as sizing, material, care and cleaning instructions. This is also a great space to write what makes this product special and how your customers can benefit from this item.
bottom of page
/assets/js/gold-ticker.js index.html (add the HTML + CSS above)