Skip to main content
All CollectionsTracking code
Connect events from Google Analytics
Connect events from Google Analytics
Simon avatar
Written by Simon
Updated over a week ago

How does it work?

If you have already set up custom events in your Google Analytics account, you can easily use them with LiveSession. You can configure LiveSession callback to collect data every time the GA tracker sends a custom event.

Edit the code below according to your needs to start tracking GA custom events.

Custom Events are available via JS API. Learn how to use it.

How can I install this integration?

To install integration, edit your tracking ID (UA-XXXXXXXXX-X) and add the code after initializing Google Analytics and LiveSession.

<script> = || function() { (ga.q = ga.q || []).push(arguments); }; ga.l = +new Date(); ga("create", "UA-XXXXXXXXX-X", "auto"); ga("send", "pageview"); ga(function (tracker) { var originalSendHitTask = tracker.get("sendHitTask"); tracker.set("sendHitTask", function (model) { originalSendHitTask(model); var eventType = tracker.get("eventCategory"); if (window.__ls) { window.__ls("track", eventType, { category: eventType, action: tracker.get("eventAction"), }); } }); }); </script>

To make this integration works, you need to have Google Analytics and LiveSession installed on your website. If you haven’t installed our tracking code yet check this article.

Did this answer your question?