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.

  1. 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",
    });
    }, []);
  2. Recommended To capture screenviews automatically, enable autocapture by setting enableRNAutocapture to true.

    App.js
    import { CSQ } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.configureProductAnalytics({
    envId: "YOUR_ENVIRONMENT_ID",
    enableRNAutocapture: true,
    });
    }, []);
  3. Recommended To capture user interactions automatically, add the option disableInteractionAutocapture: false :

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

    App.js
    import { CSQ } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.configureProductAnalytics({
    envId: "YOUR_ENVIRONMENT_ID",
    enableRNAutocapture: true,
    disableInteractionAutocapture: false,
    baseUrl: "https://mh.ba.contentsquare.net",
    });
    }, []);
  5. Add the resumePreviousSession: true and disablePageviewAutocapture: true options to the configuration.

    App.js
    import { CSQ } from "@contentsquare/react-native-bridge";
    useEffect(() => {
    CSQ.configureProductAnalytics({
    envId: "YOUR_ENVIRONMENT_ID",
    enableRNAutocapture: true,
    disableInteractionAutocapture: false,
    resumePreviousSession: true,
    disablePageviewAutocapture: true,
    });
    }, []);