OpenReplay
Navigate back to the homepage
BLOG
Browse Repo
Back

Integrating OpenReplay with Jira

Samaila Bala
September 24th, 2021 · 3 min read

As web developers, we’ve all encountered a user complaining about an error while using the application we’ve developed and most times, we would love to have been able to know what exactly led to the error. Session replay is a way for developers to monitor the actions taking by users that resulted in an error.

In this article, we will track the errors encountered by a user in a web application using an open-source session replay tool called Open Replay and then submit those errors to Jira, a project management and issue tracking tool.

To follow along with this article, you’ll need to have a deployed Open Replay instance. You can follow along with the guides listed here or use the SAAS solution Asayer. You’ll also need to have the following:

  • Knowledge of JavaScript and React
  • Node.js v12 or greater
  • npm
  • Jira Account

Creating a Web Application

We will be creating a demo application using Create React App. To get started, open a terminal and run the code below:

1npx create-react-app sample-app

The code above creates a React application called sample-app. It is a basic React application. Navigate to the sample-app directory and run the code below to start the application

1npm start

We will be creating a basic counter application to increase and decrease the value of a number. Open the App.js file and paste the code below:

1import { useState } from 'react';
2import logo from './logo.svg';
3import './App.css';
4function App() {
5 const [counter, setCounter] = useState(0);
6 const handleClick = (operation = '+') => {
7 if (operation === '-') {
8 if (counter < 0) {
9 throw new Error('Number is less than zero');
10 }
11 setCounter((prevState) => (prevState -= 1));
12 return;
13 }
14 setCounter((prevState) => (prevState += 1));
15 };
16 return (
17 <div className='App'>
18 <header className='App-header'>
19 <img src={logo} className='App-logo' alt='logo' />
20 <p>
21 Edit <code>src/App.js</code> and save to reload.
22 </p>
23 <a className='App-link' href='https://reactjs.org' target='_blank' rel='noopener noreferrer'>
24 Learn React
25 </a>
26 </header>
27 <main>
28 <button onClick={() => handleClick('-')}>-</button>
29 <p>{counter}</p>
30 <button onClick={() => handleClick()}>+</button>
31 </main>
32 </div>
33 );
34}
35export default App;

The code above allows a user to increase or decrease the value of a count, with a catch. If the user decreases the value of count below zero it throws an error.

null

Connecting Open Replay to an Application

After creating the application, the next step is connecting Open Replay to the application to start monitoring user events. Open Replay provides a JavaScript library to help integrate OpenReplay into your web application. Run the code below to install the application:

1npm i @openreplay/tracker

After installation:

  1. Go to your deployed OpenReplay instance and click on “Add New Project” null

  2. Enter the name of the project in the modal that comes up and click on Add to create the project null

  3. Click the Settings icon to go to Preferences

null

  1. Select Projects
  2. Click on the “Tracking code” button for the Project created
  3. Copy the code in the usage section
  4. Open the App.js file and paste the copied code before the begininning of the App function

Our App.js file should now look like the code below

1import { useState } from 'react';
2import logo from './logo.svg';
3import './App.css';
4import Tracker from '@openreplay/tracker';
5const tracker = new Tracker({
6 projectKey: 'O6Q7rBQdbxGMWgIeL7rd',
7 ingestPoint: 'https://app.openreplaytutorial.ga/ingest',
8});
9tracker.start();
10function App() {
11// rest of the original code

Open Replay doesn’t work in dev environments, so you’ll need to push your code to a repository and deploy it to a server for the tracking to work. I recommend platforms like Netlify and Vercel (here is a quick tutorial on deploying your app on Netlify).

After a successful deployment, visit your deployed application and perform operations for a session to be recorded. Close the browser tab when done to stop recording the session. Visit your Open Replay instance dashboard to view the recorded session after recording. After terminating a session, it usually takes about 4 minutes to reflect on the OpenReplay dashboard, so be patient if you don’t see the recorded session immediately.

null

Connecting Open Replay to Jira

At this point, we’ve successfully connected our web application to Open Replay and have recorded a session. Now what we want to achieve is creating issues on Jira from recorded sessions on Open Replay.

  1. Go to the API Token creation page on Jira’s page (I’m assuming you’ve already registered and have a valid account for the application).
  2. Click on “Create API token”
  3. Enter “openreplay” in the label field
  4. Click on Create
  5. Copy the API Token to your clipboard
  6. Go to your Open Replay dashboard then ‘Preferences > Integration’
  7. Click on Jira
  8. Put in your username and the copied API token in the modal that opens up
  9. Enter Jira instance url

We’ve successfully integrated Jira into Open Replay. The next step is creating an issue from a recorded session.

  1. Go to your Open Replay dashboard
  2. Click on a recorded session
  3. Click on the Report issue button on the top right corner of the page.

null

  1. Fill the details on the modal that opens
  2. Click on Create

After creating the issue, go to your Jira dashboard, you can see its details there. It should be similar to the screenshot below based on the data you provided in the modal

null

null

Open Source Session Replay

Debugging a web application in production may be challenging and time-consuming. OpenReplay is an Open-source alternative to FullStory, LogRocket and Hotjar. It allows you to monitor and replay everything your users do and shows how your app behaves for every issue. It’s like having your browser’s inspector open while looking over your user’s shoulder. OpenReplay is the only open-source alternative currently available.

OpenReplay

Happy debugging, for modern frontend teams - Start monitoring your web app for free.

Conclusion

In this article, we’ve looked at what session replay is all about and how to use Open Replay, a session replay tool, to record a user’s steps before encountering an error. We’ve also seen how we can create issue trackers on Jira from the recorded session replays, which goes a long way in helping developers resolve issues quickly.

OpenReplay also has a supportive community on Slack to help you with issues you come across.

More articles from OpenReplay Blog

Front-end monitoring with Sentry.io and React

The perception of a business' quality is often what the user first sees and experiences through its website. Learn how to use Sentry.io to monitor your website's performance.

September 21st, 2021 · 3 min read

Implementing Your First End-to-End Tests In React Using Cypress

Learn the importance of E2E tests and how to implement your very first test with Cypress

September 16th, 2021 · 8 min read
© 2021 OpenReplay Blog
Link to $https://twitter.com/OpenReplayHQLink to $https://github.com/openreplay/openreplayLink to $https://www.linkedin.com/company/18257552