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.
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:
<script src="https://cdn.lr-ingest.io/LogRocket.min.js" crossorigin="anonymous"></script>
<script>window.LogRocket && window.LogRocket.init('{{ API ID }}');</script>
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.
<!-- This is placed in your html head -->
<script src="https://cdn.lr-ingest.io/LogRocket.min.js" crossorigin="anonymous"></script>
{%- graphql results = "modules/<%= admin_folder_name =%>/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.
Subscribe to our newsletter for the latest news and product updates straight to your inbox.