Class: Consently::Providers::Clarity

Inherits:
Base
  • Object
show all
Defined in:
lib/consently/providers/clarity.rb

Overview

Microsoft Clarity: session recordings and heatmaps.

Constant Summary

Constants inherited from Base

Base::SAFE_OPTION

Instance Attribute Summary

Attributes inherited from Base

#category, #key, #options

Instance Method Summary collapse

Methods inherited from Base

build, cookie, cookie_manifest, #cookies, google?, #google?, #initialize, #noscript, provider_key, provider_key=, register, registry, #to_s

Constructor Details

This class inherits a constructor from Consently::Providers::Base

Instance Method Details

#scriptsObject



14
15
16
17
18
19
20
21
# File 'lib/consently/providers/clarity.rb', line 14

def scripts
  [ Script.new(inline: <<~JS.strip) ]
    (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", "#{id}");
  JS
end