If you want to add Microsoft Clarity tracking to your site, you will be asked to add some code to your site's <head>
tag.
The easiest way to do this is add a snippet that hooks to the wp_head
action. Here's an example:
add_action( 'wp_head', function () { ?> <script type="text/javascript"> (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "XXXXXXXXXX"); </script> <?php } );
Remember to replace XXXXXXXXXX
in the code above with your actual project ID.