Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Latest commit

 

History

History
112 lines (85 loc) · 2.82 KB

File metadata and controls

112 lines (85 loc) · 2.82 KB

Getting Started

Track your first screen

// src/App.tsx

import React, { useEffect } from 'react';
import AtInternet from '@lemonde/react-native-at-internet';

export default function App() {

    useEffect(() => {
        (async () => {
            await AtInternet.screen({
                name: 'Page name',
                chapter1: 'Chapter 1',
                chapter2: 'Chapter 2',
                chapter3: 'Chapter 3',
            });
        })();
    });

    // ...
}

Track your first action

// src/App.tsx

import React, { useEffect } from 'react';
import { TouchableOpacity } from 'react-native';
import AtInternet from '@lemonde/react-native-at-internet';

export default function App() {

    const trackPress = async () => {
        await AtInternet.touch({
            name: 'Your button'
        });
    };

    return (
        <>
            <TouchableOpacity
            onPress={trackPress}>
            <Text>
              Your button
            </Text>
          </TouchableOpacity>
        </>
    );
}

Using custom configuration (subdomain, ssl, …)

All configuration keys are defined here : Android and iOS

Please be sure to use the correct type (setConfigString, setConfigBoolean, setConfigInteger or setConfigDouble).

// src/App.tsx

import React, { useEffect } from 'react';
import AtInternet from '@lemonde/react-native-at-internet';

export default function App() {
    useEffect(() => {
        (async () => {
            await AtInternet.setConfigString('log', 'sub');
            await AtInternet.setConfigString('logSSL', 'sub');
            await AtInternet.setConfigBoolean('secure', true);
            await AtInternet.setConfigString('domain', 'example.com');
            await AtInternet.setConfigString('pixelPath', '/hit.gif');
            await AtInternet.setConfigInteger('site', 123456);
                })();
    });

    // ...
}

Listening to events

// src/App.tsx

import React, { useEffect } from 'react';
import AtInternet from '@lemonde/react-native-at-internet';

export default function App() {
    useEffect(() => {
        (async () => {
            // iOS only 
            await AtInternet.enableListeners();
            
            AtInternet.EventEmitter.removeAllListeners(AtInternet.Events.buildDidEnd);
            
            AtInternet.EventEmitter.addListener(AtInternet.Events.buildDidEnd, ({message, status}) => {
                console.log('buildDidEnd', message, status);
            });
    });

    // ...
}