React Native Analytics
If you haven't already, please start with the Analytics Overview below.
📄️ Analytics Overview
React Native Analytics Callback
- TypeScript
- JavaScript
import React from 'react';import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';import { NativeStackNavigationProp } from '@react-navigation/native-stack';import { AnalyticsParameters, OptionResponse, PollView,} from '@polls-platform/react-native';const PollScreen = () => { const route = useRoute<RouteProp<RootStackParamList, 'Poll'>>(); const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>(); const didPressViewDetails = (option: OptionResponse) => { navigation.push('Details', { resourceId: option.resourceId }); }; const didReceiveAnalyticsEvent = ( event: string, parameters?: AnalyticsParameters, ) => { // send events to Google Analytics }; return ( <PollView pollUrl={route.params.url} didPressViewDetails={didPressViewDetails} didReceiveAnalyticsEvent={didReceiveAnalyticsEvent} /> );};export default PollScreen;
import React from "react";import { useNavigation, useRoute } from "@react-navigation/native";import { PollView } from "@polls-platform/react-native";const PollScreen = () => { const route = useRoute(); const navigation = useNavigation(); const didPressViewDetails = (option) => { navigation.push("Details", { resourceId: option.resourceId }); }; const didReceiveAnalyticsEvent = (event, parameters) => { // send events to Google Analytics }; return ( <PollView pollUrl={route.params.url} didPressViewDetails={didPressViewDetails} didReceiveAnalyticsEvent={didReceiveAnalyticsEvent} /> );};export default PollScreen;