For the complete documentation index, see llms.txt.

Set up Product Analytics data capture

This page instructs how to set up Product Analytics data capture in combination with Experience Analytics.

  1. Add the React Native Babel Autocapture Plugin to instrument your app code:

    In your babel.config.js file, add @contentsquare/react-native-bridge/babel to the plugins array:

    babel.config.js
    module.exports = {
    presets: ['module:@react-native/babel-preset'],
    plugins: ['@contentsquare/react-native-bridge/babel'],
    };

    Make sure to add the plugin to all relevant babel.config.js files in your project, including those in any packages that contain React Native code.

  2. Add your Product Analytics Environment ID using start().

    App.js
    import { CSQ, StartConfig } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.start(StartConfig.withEnvironmentId("YOUR_ENVIRONMENT_ID"));
    }, []);
  3. To capture interactions and screenviews automatically, enable autocapture by setting enableRNAutocapture to true.

    App.js
    import { CSQ, StartConfig } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.start(StartConfig.withEnvironmentId("YOUR_ENVIRONMENT_ID", {
    enableRNAutocapture: true,
    }));
    }, []);
  4. (Optional) If your Product Analytics environment is hosted in the EU, set the baseUrl option to https://mh.ba.contentsquare.net.

    App.js
    import { CSQ, StartConfig } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.start(StartConfig.withEnvironmentId("YOUR_ENVIRONMENT_ID", {
    enableRNAutocapture: true,
    baseUrl: "https://mh.ba.contentsquare.net",
    }));
    }, []);
  5. Add the disablePageviewAutocapture: true option to the configuration.

    App.js
    import { CSQ, StartConfig } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.start(StartConfig.withEnvironmentId("YOUR_ENVIRONMENT_ID", {
    enableRNAutocapture: true,
    disablePageviewAutocapture: true,
    }));
    }, []);