react-native-clarity
A ReactNative plugin that allows integrating Clarity with your application.
Installation
npm install react-native-clarity
Usage
import { initialize, setCustomUserId, getCurrentSessionId, setCurrentScreenName, setCustomTag } from 'react-native-clarity';
initialize("<ProjectId>");
setCustomUserId("react@native.com");
setCustomTag("key", "value");
getCurrentSessionId().then((id) => {...});
import { ..., useFocusEffect } from '@react-navigation/native';
const HomeScreen = ({...}) => {
useFocusEffect(
React.useCallback(() => {
setCurrentScreenName("Home");
return () => { setCurrentScreenName(undefined); }
}, [])
);
...
};
Initialization arguments
function initialize(
projectId: string,
userId?: string,
logLevel: string = "None",
allowMeteredNetworkUsage: boolean = false,
enableWebViewCapture: boolean = true,
allowedDomains: string[] = ["*"])
License
MIT