Insites Docs Articles How to install Log Rocket
TECHNOLOGY

How to install Log Rocket

Published on May 07, 2021, updated on June 18, 2021

What is Log Rocket?

 
Log Rocket is an app that is installed to your website that can help in tracking user behaviour and fix bugs by capturing and recording user sessions from your websites. This app helps in debugging and reproducing bugs found by the end-user.
 
 

How to install Log Rocket

 
In order to use Log Rocket, We need to install it first to our Website. First, Login to https://app.logrocket.com/ then Go to Settings -> Project Setup.

 
There are 2 ways to install Log Rocket:

  1. via NPM - used for JavaScript frameworks (VueJS, React, Angular)
  2. via Script Tag (CDN) API ID
<script src="https://cdn.lr-ingest.io/LogRocket.min.js" crossorigin="anonymous"></script>
<script>window.LogRocket && window.LogRocket.init('{{ API ID }}');</script>
  • To get the API ID, go to General Settings -> API - ID

 
Once you have installed LogRocket we need to identify the users.
 
 
Example:
 

LogRocket.identify('123456', {
  name: 'Jone Smith',
  email: 'jonesmith@logrocket.com',
  currentSubscription: 'test',
});

 
 
This will save the user credentials on to LogRocket and which can be used for filtering and searching.
 

  • uid - user_id
  • name - User's first name and last name
  • email
  • currentSubscription - for Dulux, this is the builder type
     
     
    Example Code:
     
<!-- This is placed in your html head -->
<script src="https://cdn.lr-ingest.io/LogRocket.min.js" crossorigin="anonymous"></script>
{%- graphql results = "modules/&lt;%= admin_folder_name =%&gt;/session/get_current_user" -%}
<script>
    window.LogRocket && window.LogRocket.init('cwipq3/dulux');
    {%- if results.current_user.id != blank -%}
      LogRocket.identify('{{ results.current_user.id }}', {
          name: '{{ results.current_user.first_name }} {{ results.current_user.last_name }}',
          email: '{{ results.current_user.email }}',
          currentSubscription: '{{ context.location.search.builder | capitalize }}'
      });
    {%- endif -%}
</script> 

 
 
This will monitor all console errors and add it to LogRocket records. If there is a user logged in, it will include the some user details (ID, Email, name, builder type), if not the user will be anonymous.

Stay up to date with Insites

Subscribe to our newsletter for the latest news and product updates straight to your inbox.