Set up Product Analytics data capture
This page instructs how to set up data capture in the context of the User Lifecycle Extension for Experience Analytics.
-
Add Autocapture Plugin React Native Bridge
Section titled Add Autocapture Plugin React Native BridgeAdd the React Native Babel Autocapture Plugin to instrument your app code:
In your
babel.config.jsfile, add@contentsquare/react-native-bridge/babelto the plugins array:babel.config.js module.exports = {presets: ['module:@react-native/babel-preset'],plugins: ['@contentsquare/react-native-bridge/babel'],}; -
Add your Product Analytics Environment ID using
CSQ.configureProductAnalytics().App.js import { CSQ } from "@contentsquare/react-native-bridge";useEffect(() => {CSQ.configureProductAnalytics({envId: "YOUR_ENVIRONMENT_ID",});}, []); -
Recommended To capture screenviews automatically, enable autocapture by setting
enableRNAutocapturetotrue.App.js import { CSQ } from "@contentsquare/react-native-bridge";useEffect(() => {CSQ.configureProductAnalytics({envId: "YOUR_ENVIRONMENT_ID",enableRNAutocapture: true,});}, []); -
(Optional) If your Product Analytics environment is hosted in the EU, set the
baseUrioption tohttps://mh.ba.contentsquare.net.App.js import { CSQ } from "@contentsquare/react-native-bridge";useEffect(() => {CSQ.configureProductAnalytics({envId: "YOUR_ENVIRONMENT_ID",enableRNAutocapture: true,baseUrl: "https://mh.ba.contentsquare.net",});}, []); -
Add the
resumePreviousSession: trueanddisablePageviewAutocapture: trueoptions to the configuration.App.js import { CSQ } from "@contentsquare/react-native-bridge";useEffect(() => {CSQ.configureProductAnalytics({envId: "YOUR_ENVIRONMENT_ID",enableRNAutocapture: true,resumePreviousSession: true,disablePageviewAutocapture: true,});}, []);