Understanding the widget embed code
The widget embed snippet is a small piece of JavaScript that loads the Certorix widget from the CDN and initialises it with your configuration.
Example snippet
<script>
(function(w,d,s,o,f,js,fjs){
w['CertorixWidget']=o;w[o]=w[o]||function(){(w[o].q=w[o].q||[]).push(arguments)};
js=d.createElement(s),fjs=d.getElementsByTagName(s)[0];
js.async=1;js.src=f;fjs.parentNode.insertBefore(js,fjs);
})(window,document,'script','cw','https://cdn.certorix.com/widget.js');
cw('init', {
treeId: 'tree_123abc',
orgId: 'org_456def',
trigger: 'button',
position: 'bottom-right',
primaryColor: '#1a3a5c',
logoUrl: 'https://example.com/logo.png'
});
</script>What the code does
- Creates a global
cw(Certorix Widget) function for configuration. - Loads the widget script asynchronously from the CDN so it doesn't block page rendering.
- Initialises the widget with your settings: which tree to load, org ID, trigger type, appearance.
- When the script loads, it renders the widget (floating launcher or embedded panel).
Placement best practices
Paste the snippet just before the closing </body> tag for optimal performance. Do not paste it inside the <head> unless you defer execution.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article