Skip to main content

Activity history

Shake tracks user's interaction with your app, their network traffic, notifications, logs and system events, and automatically attaches all of those to the ticket.

Setup

User actions

SDK automatically observes taps made on your app's UI elements.

Network traffic

Network traffic logging is disabled by default. Enable it using the following method:

App.js
Shake.setNetworkRequestsEnabled(true);

You can add your own custom network requests at any time:

App.js
import Shake, { NetworkRequestBuilder } from '@shakebugs/react-native-shake';
const networkRequestBuilder = new NetworkRequestBuilder()
.setMethod('POST')
.setStatusCode('200')
.setUrl('https://api.example.com')
.setRequestBody('Request body')
.setResponseBody('Response body')
.setRequestHeaders({header1: 'requestHeader'})
.setResponseHeaders({header2: 'responseHeader'})
.setDuration(100)
.setDate(new Date());
Shake.insertNetworkRequest(networkRequestBuilder);

System events

System events - also known as app lifecycle events - are tracked automatically and require no additional setup.

Notifications

On iOS, notifications are tracked automatically and require no additional setup.

Android requires notifications permission in settings to track notifications. Use the following code snippet to show notification settings screen to the user:

App.js
Shake.showNotificationsSettings();

You can add your own custom notification events at any time:

App.js
import Shake, { NotificationEventBuilder } from '@shakebugs/react-native-shake';
const notificationEventBuilder = new NotificationEventBuilder()
.setId('0')
.setTitle('Title')
.setDescription('Description');
Shake.insertNotificationEvent(notificationEventBuilder);

Custom logs

You can add your own logs to Activity history too:

App.js
import Shake, { LogLevel } from '@shakebugs/react-native-shake';
const sendCustomLog = () => {
Shake.log(LogLevel.INFO, 'This is a Shake custom log.');
}

You have these log levels at your disposal:

LogLevel.VERBOSE
LogLevel.DEBUG
LogLevel.INFO
LogLevel.WARN
LogLevel.ERROR

Console logs

On Android, console logs are recorded automatically and require no additional setup. If you want to disable this feature use the method below:

App.js
Shake.setConsoleLogsEnabled(false);

For iOS apps, add the following code snippet to your AppDelegate.m to make sure that console logs are recorded by Shake:

AppDelegate.m
#import <React/RCTLog.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
RCTSetLogThreshold(RCTLogLevelInfo);
RCTAddLogFunction(ShakeLogFunction);
...
}
RCTLogFunction ShakeLogFunction = ^(RCTLogLevel level, __unused RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
NSString *log = RCTFormatLog([NSDate date], level, fileName, lineNumber, message);
NSLog(@"%@", log);
};

Limitations

In a Free workspace you can see up to 20 events that led to the ticket being reported. If you need to dive really deep to find causes of the weirdest bugs, in a Premium workspace you can browse the full Activity history.

The network request limits for both the request body and the response body are 100 kB each. If the request body or the response body contains binary data, it will be presented as a Binary data string.

Disable

Activity history is enabled by default, use the method below to disable it altogether:

App.js
Shake.setEnableActivityHistory(false);