Quickstart

Quickstart: Optimise your finance widget's performance

A funding widget should add near-zero weight — defer the script, cache the data, reserve its space and lazy-load it below the fold. This recipe gives you the exact code, uses only the unauthenticated public ring, and links to the endpoints and the application flow so the reader always has a next step.

2 min read

deferNon-blocking script
no CLSReserve the space
lazyLoad when near view

Load without blocking

<div id="cc-finance" style="min-height:120px"></div>
<script src="/cc-widget.js" defer></script>

defer keeps the script off the critical path, and a reserved min-height prevents cumulative layout shift when the content arrives.

Lazy-load below the fold

new IntersectionObserver((entries, io) => {
  if (entries[0].isIntersecting) { initWidget(); io.disconnect(); }
}).observe(document.getElementById('cc-finance'));

If the widget sits below the fold, only initialise it when it is about to scroll into view. Combined with a cached catalogue, the widget costs almost nothing on load.

Frequently asked questions

How do I avoid layout shift?

Reserve the widget's space with a min-height so the page does not jump when content loads. This protects your Core Web Vitals.

Should the widget block rendering?

No. Load it deferred and, if it is below the fold, lazy-initialise it so it never delays the visible page.

Funding for UK limited companies

Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.