Installation
Installing Fidero takes one script in your page’s <head>. It loads the SDK and
pulls your project’s configuration from the server, so nothing else goes in your
page: no per-tool tags and no configuration to maintain.
Add the snippet
Section titled “Add the snippet”Paste this into your <head>, and replace YOUR_PROJECT_ID with your project’s
ID.
<!-- Fidero: paste in your <head> --><script> // prettier-ignore !function(){let e=window.fidero=window.fidero??{};if(e.initialised)return;if(e.invoked)return console.error("[Fidero] Snippet included multiple times");e.invoked=!0;let r={};e.ready=new Promise((e,t)=>{r.resolve=e,r.reject=t}),e.ready.resolve=r.resolve,e.ready.reject=r.reject,e.buffered=[],e.initArgs=null,e.init=function(){return e.initArgs=Array.prototype.slice.call(arguments),e.ready};let t=function(r,t){return function(){let n=Array.prototype.slice.call(arguments);if(n.unshift(r),!t)return void e.buffered.push(n);let i={},d=new Promise(function(e,r){i.resolve=e,i.reject=r});return d.delivered=new Promise(function(e,r){i.resolveDelivered=e,i.rejectDelivered=r}),d.catch(function(){}),d.delivered.catch(function(){}),n.deferred=i,e.buffered.push(n),d}};["updateConsent","updateIdentity","reset"].forEach(r=>{e[r]=t(r,!1)}),["page","track"].forEach(r=>{e[r]=t(r,!0)}),e.load=r=>{let t=(r=r||"https://cdn.datahappy.co/sdk/v0.9/fidero.js").match(/.+sdk\/v?(.+)\/fidero.js/);null!==t&&t.length>=2&&(e.version=t[1]);let n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=r,(document.head||document.body).appendChild(n)}}()
fidero.load(); fidero.init("YOUR_PROJECT_ID"); fidero.page();</script>What the snippet does
Section titled “What the snippet does”The snippet is about a kilobyte and loads asynchronously, so it never blocks your page. It runs three calls:
fidero.load()– fetches the SDK from Fidero’s CDN and adds it to the pagefidero.init("YOUR_PROJECT_ID")– starts the SDK and pulls your project’s configuration by IDfidero.page()– records the first page view
Any calls you make before the SDK finishes loading (a track in your app code,
say) are queued and run in order once it’s ready, so nothing is lost.
How your configuration loads
Section titled “How your configuration loads”When init() runs, the SDK uses your project ID to fetch your configuration from
Fidero’s server. That configuration governs everything Fidero does: which
integrations run, how Fidero applies consent and which destinations receive your
events. It lives on the server, not in your page, which is why the install is one
script and nothing else.
To change what Fidero does, you request it and the change lands in that server-side configuration, not your page. A new destination or a mapping update reaches you with no code change.
Configuration covers the options you can pass
to init(). For why your configuration is server-governed rather than wired into
your page, see the platform overview.