Install session replay with Google Tag Manager
The GTM route needs no code change and no deploy — if you can publish a container, you can start recording today.
- In GTM, create a new tag: Tag Configuration → Custom HTML.
- Paste the snippet below (your dashboard generates it with your key filled in):
<script>
window.logcohort||(function(w,d){
var o=w.logcohort=function(){o.api.push(arguments)};o.api=[];o._v='1';
o._w={fetch:w.fetch};
w.fetch&&(w.fetch=function(){return o._w.fetch.apply(this,arguments)});
var c=d.createElement('script');c.async=true;c.type='text/javascript';
c.src='https://app.logcohort.com/recorder.js';
c.onerror=function(){w.console&&w.console.warn&&w.console.warn('[logcohort] recorder failed to load from '+c.src)};
d.getElementsByTagName('head')[0].appendChild(c);
})(window,document);
logcohort('init','lc_YOUR_PROJECT_KEY');
</script>- Set the trigger to All Pages.
- Publish the container.
- Visit your site, click around, and open the logcohort dashboard — the session appears within seconds.
Trade-off to know: GTM itself loads asynchronously, so recording starts a moment later than a direct <head>install. For most sites this is invisible; if you want the earliest possible start, use the plain HTML install instead.
Next: identify signed-in users.