### Start Metro Server for Example App Source: https://github.com/bejutassle/react-native-skadnetwork/blob/master/CONTRIBUTING.md Starts the Metro bundler, which is necessary for running the example application. This command is used to serve the JavaScript code to the example app during development. ```sh yarn example start ``` -------------------------------- ### Start Metro Server for React Native Source: https://github.com/bejutassle/react-native-skadnetwork/blob/master/example/README.md Starts the Metro bundler, which is essential for running React Native applications. This command should be executed from the root of the React Native project. ```bash # using npm npm start # OR using Yarn yarn start ``` -------------------------------- ### Install Project Dependencies with Yarn Source: https://github.com/bejutassle/react-native-skadnetwork/blob/master/CONTRIBUTING.md Installs all project dependencies required for the monorepo, leveraging Yarn workspaces. This is the initial setup step for development. ```sh yarn ``` -------------------------------- ### Install react-native-skadnetwork using Yarn or npm Source: https://context7.com/bejutassle/react-native-skadnetwork/llms.txt Instructions for installing the SKAdNetwork package using either Yarn or npm package managers. This is the first step before proceeding with iOS setup. ```bash # Install the package yarn add react-native-skadnetwork # or npm install react-native-skadnetwork # iOS setup - navigate to ios directory and install pods cd ios pod install cd .. ``` -------------------------------- ### Run Example App on iOS Source: https://github.com/bejutassle/react-native-skadnetwork/blob/master/CONTRIBUTING.md Builds and runs the example application on an connected iOS device or simulator. This command is essential for testing library changes on iOS. ```sh yarn example ios ``` -------------------------------- ### Run Example App on Android Source: https://github.com/bejutassle/react-native-skadnetwork/blob/master/CONTRIBUTING.md Builds and runs the example application on an connected Android device or emulator. This command is essential for testing library changes on Android. ```sh yarn example android ``` -------------------------------- ### Basic SKAdNetwork initialization in React Native Source: https://context7.com/bejutassle/react-native-skadnetwork/llms.txt A basic implementation example in JavaScript to initialize SKAdNetwork tracking on app launch using the 'react-native-skadnetwork' library. It logs an 'install' event (event code 5). ```javascript // Basic implementation in your app's entry point import React, { useEffect } from 'react'; import { logEventSKAdNetwork } from 'react-native-skadnetwork'; function App() { useEffect(() => { // Initialize SKAdNetwork on app launch const initializeSKAd = async () => { try { await logEventSKAdNetwork(5); // Track install } catch (error) { console.error('SKAdNetwork initialization failed:', error); } }; initializeSKAd(); }, []); return ( // Your app components ); } export default App; ``` -------------------------------- ### React Native SKAdNetwork Component Integration Source: https://context7.com/bejutassle/react-native-skadnetwork/llms.txt Demonstrates a complete example of integrating SKAdNetwork tracking within a React Native application. It covers logging initial install events, user signups, purchases (with SKAdNetwork 4 parameters), and ad views. Requires the 'react-native-skadnetwork' library. ```javascript import React, { useEffect, useState } from 'react'; import { StyleSheet, View, Text, Button, Alert } from 'react-native'; import { logEventSKAdNetwork } from 'react-native-skadnetwork'; const events = { SIGNUP: 0, LEVEL_1: 1, LEVEL_2: 2, AD_VIEW: 3, PURCHASE: 4, INSTALL: 5, }; export default function App() { const [lastEvent, setLastEvent] = useState(null); // Log initial install event useEffect(() => { const trackInstall = async () => { try { await logEventSKAdNetwork(events.INSTALL); setLastEvent('INSTALL'); console.log('Install event tracked'); } catch (error) { console.error('Failed to track install:', error); } }; trackInstall(); }, []); const handleUserSignup = async () => { try { // Perform signup logic await logEventSKAdNetwork(events.SIGNUP); setLastEvent('SIGNUP'); Alert.alert('Success', 'Signup tracked'); } catch (error) { Alert.alert('Error', 'Failed to track signup'); } }; const handlePurchase = async () => { try { // Perform purchase logic // Use SKAN 4 parameters for high-value conversion await logEventSKAdNetwork(events.PURCHASE, 2, true); setLastEvent('PURCHASE'); Alert.alert('Success', 'Purchase tracked'); } catch (error) { Alert.alert('Error', 'Failed to track purchase'); } }; const handleAdView = async () => { try { await logEventSKAdNetwork(events.AD_VIEW, 0, false); setLastEvent('AD_VIEW'); } catch (error) { console.error('Failed to track ad view:', error); } }; return ( SKAdNetwork Integration Last Event: {lastEvent || 'None'}