Skip to content

GDPR Compliance

Overview

As per GDPR's data protection laws, it is mandatory for all applications to implement the following methods. These methods allow users to control the information that they share with Upshot.ai.

The Upshot React Native SDK provides comprehensive tools to help your application comply with GDPR (General Data Protection Regulation) requirements, including user data deletion, marketing opt-outs, and data collection controls.

User Disable (Right to be Forgotten)

Disable User

This method is used to delete all recorded data and disable Upshot.ai for a user (appuid).

Important Notes:

  • Once a data subject requests deletion, all data coming from any device associated with that user will be stopped
  • Events and user profile updates are blocked for disabled users
  • Only campaigns for unregistered users will be available for displaying
  • When a user profile is deleted, no future data is tracked about the user
  • If the user wants to start sending data again, appropriate APIs must be invoked
javascript
import Upshot from "react-native-upshotsdk";
// Disable user and delete all data
Upshot.disableUser(function (status) {
  if (status) {
    console.log("User successfully disabled and data deleted");
  } else {
    console.log("Failed to disable user");
  }
});
typescript
import Upshot from "react-native-upshotsdk";
// Disable user and delete all data
Upshot.disableUser((status: boolean) => {
  if (status) {
    console.log("User successfully disabled and data deleted");
  } else {
    console.log("Failed to disable user");
  }
});

Marketing Opt-Out

In compliance with GDPR, users can opt out from all marketing channels. The SDK provides flags to control different marketing channels:

Marketing Channel Flags

  • push_opt - Controls push notification delivery
  • sms_opt - Controls SMS message delivery
  • email_opt - Controls email message delivery
  • ip_opt - Controls IP address usage for geolocation

Important

Setting any opt-out flag to true means disable that marketing channel. Set to false to enable the channel.

Push Notification Opt-Out

Block push notifications for a specific user:

javascript
import Upshot from "react-native-upshotsdk";
const optOutDetails = {
  push_opt: true, // true = disable push notifications
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), function (response) {
  console.log("Push opt-out status updated:", response);
});
typescript
import Upshot from "react-native-upshotsdk";
interface OptOutDetails {
  push_opt: boolean;
}

const optOutDetails: OptOutDetails = {
  push_opt: true, // true = disable push notifications
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), (response: any) => {
  console.log("Push opt-out status updated:", response);
});

SMS Opt-Out

Block SMS notifications for a specific user:

javascript
const optOutDetails = {
  sms_opt: true, // true = disable SMS notifications
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), function (response) {
  console.log("SMS opt-out status updated:", response);
});
typescript
const optOutDetails = {
  sms_opt: true, // true = disable SMS notifications
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), (response: any) => {
  console.log("SMS opt-out status updated:", response);
});

Email Opt-Out

Block email messages for a specific user:

javascript
const optOutDetails = {
  email_opt: true, // true = disable email messages
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), function (response) {
  console.log("Email opt-out status updated:", response);
});
typescript
const optOutDetails = {
  email_opt: true, // true = disable email messages
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), (response: any) => {
  console.log("Email opt-out status updated:", response);
});

IP Address Opt-Out

Capture IP address but disable geolocation usage:

javascript
const optOutDetails = {
  ip_opt: true, // true = disable IP geolocation for reports
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), function (response) {
  console.log("IP opt-out status updated:", response);
});
typescript
const optOutDetails = {
  ip_opt: true, // true = disable IP geolocation for reports
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), (response: any) => {
  console.log("IP opt-out status updated:", response);
});

Complete Marketing Opt-Out

Opt out from all marketing channels at once:

javascript
const optOutDetails = {
  email_opt: true, // Disable email marketing
  sms_opt: true, // Disable SMS marketing
  push_opt: true, // Disable push notifications
  ip_opt: true, // Disable IP geolocation
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), function (response) {
  console.log("Complete marketing opt-out updated:", response);
});
typescript
interface MarketingOptOut {
  email_opt: boolean;
  sms_opt: boolean;
  push_opt: boolean;
  ip_opt: boolean;
}

const optOutDetails: MarketingOptOut = {
  email_opt: true, // Disable email marketing
  sms_opt: true, // Disable SMS marketing
  push_opt: true, // Disable push notifications
  ip_opt: true, // Disable IP geolocation
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), (response: any) => {
  console.log("Complete marketing opt-out updated:", response);
});

Re-enabling Marketing Channels

To enable any marketing channel, set the respective flag to false:

javascript
const optInDetails = {
  email_opt: false, // Enable email marketing
  sms_opt: false, // Enable SMS marketing
  push_opt: false, // Enable push notifications
  ip_opt: false, // Enable IP geolocation
};

Upshot.setUserProfile(JSON.stringify(optInDetails), function (response) {
  console.log("Marketing channels re-enabled:", response);
});
typescript
const optInDetails = {
  email_opt: false, // Enable email marketing
  sms_opt: false, // Enable SMS marketing
  push_opt: false, // Enable push notifications
  ip_opt: false, // Enable IP geolocation
};

Upshot.setUserProfile(JSON.stringify(optInDetails), (response: any) => {
  console.log("Marketing channels re-enabled:", response);
});

Data Opt-Out

This right allows users to opt out of sharing any data with Data Processors.

Important Notes

  • Default behavior: Data collection is enabled by default
  • Recommendation: For GDPR compliance, consider enabling data opt-out by default and requiring explicit user consent
  • Impact: Users who opt out will have stale profiles without latest events
  • Segmentation: Past data of opted-out users may still be considered in reports based on date ranges
  • Care required: Take appropriate care when creating segments that might include opted-out user profiles

Implementing Data Opt-Out

javascript
import Upshot from "react-native-upshotsdk";
const optOutDetails = {
  data_opt: true, // true = disable all data collection
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), function (response) {
  console.log("Data opt-out status updated:", response);
});
typescript
import Upshot from "react-native-upshotsdk";
interface DataOptOut {
  data_opt: boolean;
}

const optOutDetails: DataOptOut = {
  data_opt: true, // true = disable all data collection
};

Upshot.setUserProfile(JSON.stringify(optOutDetails), (response: any) => {
  console.log("Data opt-out status updated:", response);
});

Re-enabling Data Collection

To re-enable data collection, set the flag to false:

javascript
const optInDetails = {
  data_opt: false, // false = enable data collection
};

Upshot.setUserProfile(JSON.stringify(optInDetails), function (response) {
  console.log("Data collection re-enabled:", response);
});
typescript
const optInDetails = {
  data_opt: false, // false = enable data collection
};

Upshot.setUserProfile(JSON.stringify(optInDetails), (response: any) => {
  console.log("Data collection re-enabled:", response);
});

GDPR Compliance React Component

Here's a complete React Native component for GDPR compliance:

typescript
import React, { useState } from "react";
import {
  View,
  Text,
  Switch,
  TouchableOpacity,
  Alert,
  StyleSheet,
} from "react-native";
import Upshot from "react-native-upshotsdk";
interface GDPRSettings {
  data_opt: boolean;
  email_opt: boolean;
  sms_opt: boolean;
  push_opt: boolean;
  ip_opt: boolean;
}

const GDPRComplianceScreen: React.FC = () => {
  const [settings, setSettings] = useState<GDPRSettings>({
    data_opt: false,
    email_opt: false,
    sms_opt: false,
    push_opt: false,
    ip_opt: false,
  });

  const updateSetting = (key: keyof GDPRSettings, value: boolean) => {
    const updatedSettings = { ...settings, [key]: value };
    setSettings(updatedSettings);

    // Update individual setting
    const settingUpdate = { [key]: value };
    Upshot.setUserProfile(JSON.stringify(settingUpdate), (response: any) => {
      console.log(`${key} updated:`, response);
    });
  };

  const disableUser = () => {
    Alert.alert(
      "Delete All Data",
      "This will permanently delete all your data. This action cannot be undone.",
      [
        { text: "Cancel", style: "cancel" },
        {
          text: "Delete",
          style: "destructive",
          onPress: () => {
            Upshot.disableUser((status: boolean) => {
              if (status) {
                Alert.alert(
                  "Success",
                  "All data has been deleted successfully."
                );
              } else {
                Alert.alert(
                  "Error",
                  "Failed to delete data. Please try again."
                );
              }
            });
          },
        },
      ]
    );
  };

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Privacy Settings</Text>

      <View style={styles.section}>
        <Text style={styles.sectionTitle}>Data Collection</Text>
        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Disable all data collection</Text>
          <Switch
            value={settings.data_opt}
            onValueChange={(value) => updateSetting("data_opt", value)}
          />
        </View>
      </View>

      <View style={styles.section}>
        <Text style={styles.sectionTitle}>Marketing Communications</Text>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block email marketing</Text>
          <Switch
            value={settings.email_opt}
            onValueChange={(value) => updateSetting("email_opt", value)}
          />
        </View>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block SMS marketing</Text>
          <Switch
            value={settings.sms_opt}
            onValueChange={(value) => updateSetting("sms_opt", value)}
          />
        </View>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block push notifications</Text>
          <Switch
            value={settings.push_opt}
            onValueChange={(value) => updateSetting("push_opt", value)}
          />
        </View>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block IP geolocation</Text>
          <Switch
            value={settings.ip_opt}
            onValueChange={(value) => updateSetting("ip_opt", value)}
          />
        </View>
      </View>

      <TouchableOpacity style={styles.deleteButton} onPress={disableUser}>
        <Text style={styles.deleteButtonText}>Delete All My Data</Text>
      </TouchableOpacity>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 20,
    backgroundColor: "#fff",
  },
  title: {
    fontSize: 24,
    fontWeight: "bold",
    marginBottom: 30,
  },
  section: {
    marginBottom: 30,
  },
  sectionTitle: {
    fontSize: 18,
    fontWeight: "600",
    marginBottom: 15,
    color: "#333",
  },
  settingRow: {
    flexDirection: "row",
    justifyContent: "space-between",
    alignItems: "center",
    paddingVertical: 12,
    borderBottomWidth: 1,
    borderBottomColor: "#eee",
  },
  settingText: {
    fontSize: 16,
    flex: 1,
    marginRight: 10,
  },
  deleteButton: {
    backgroundColor: "#ff3b30",
    padding: 15,
    borderRadius: 8,
    alignItems: "center",
    marginTop: 30,
  },
  deleteButtonText: {
    color: "white",
    fontSize: 16,
    fontWeight: "600",
  },
});

export default GDPRComplianceScreen;
javascript
import React, { useState } from "react";
import {
  View,
  Text,
  Switch,
  TouchableOpacity,
  Alert,
  StyleSheet,
} from "react-native";
import Upshot from "react-native-upshotsdk";
const GDPRComplianceScreen = () => {
  const [settings, setSettings] = useState({
    data_opt: false,
    email_opt: false,
    sms_opt: false,
    push_opt: false,
    ip_opt: false,
  });

  const updateSetting = (key, value) => {
    const updatedSettings = { ...settings, [key]: value };
    setSettings(updatedSettings);

    // Update individual setting
    const settingUpdate = { [key]: value };
    Upshot.setUserProfile(JSON.stringify(settingUpdate), (response) => {
      console.log(`${key} updated:`, response);
    });
  };

  const disableUser = () => {
    Alert.alert(
      "Delete All Data",
      "This will permanently delete all your data. This action cannot be undone.",
      [
        { text: "Cancel", style: "cancel" },
        {
          text: "Delete",
          style: "destructive",
          onPress: () => {
            Upshot.disableUser((status) => {
              if (status) {
                Alert.alert(
                  "Success",
                  "All data has been deleted successfully."
                );
              } else {
                Alert.alert(
                  "Error",
                  "Failed to delete data. Please try again."
                );
              }
            });
          },
        },
      ]
    );
  };

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Privacy Settings</Text>

      <View style={styles.section}>
        <Text style={styles.sectionTitle}>Data Collection</Text>
        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Disable all data collection</Text>
          <Switch
            value={settings.data_opt}
            onValueChange={(value) => updateSetting("data_opt", value)}
          />
        </View>
      </View>

      <View style={styles.section}>
        <Text style={styles.sectionTitle}>Marketing Communications</Text>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block email marketing</Text>
          <Switch
            value={settings.email_opt}
            onValueChange={(value) => updateSetting("email_opt", value)}
          />
        </View>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block SMS marketing</Text>
          <Switch
            value={settings.sms_opt}
            onValueChange={(value) => updateSetting("sms_opt", value)}
          />
        </View>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block push notifications</Text>
          <Switch
            value={settings.push_opt}
            onValueChange={(value) => updateSetting("push_opt", value)}
          />
        </View>

        <View style={styles.settingRow}>
          <Text style={styles.settingText}>Block IP geolocation</Text>
          <Switch
            value={settings.ip_opt}
            onValueChange={(value) => updateSetting("ip_opt", value)}
          />
        </View>
      </View>

      <TouchableOpacity style={styles.deleteButton} onPress={disableUser}>
        <Text style={styles.deleteButtonText}>Delete All My Data</Text>
      </TouchableOpacity>
    </View>
  );
};

// ...styles remain the same

export default GDPRComplianceScreen;

Best Practices

1. Default Settings

  • Recommendation: Enable data opt-out by default for GDPR compliance
  • User Choice: Require explicit consent before collecting any data
  • Clear Communication: Explain what data is collected and why

2. User Interface

  • Accessibility: Make privacy controls easily accessible
  • Clear Labels: Use clear, non-technical language
  • Confirmation: Confirm destructive actions like data deletion

3. Data Handling

  • Immediate Effect: Opt-out settings should take effect immediately
  • Documentation: Keep records of all user privacy choices
  • Regular Review: Review and update privacy practices regularly

4. Compliance Notes

Important Notes

  • email_opt, sms_opt, push_opt, ip_opt: true means disable the marketing channel
  • To enable: Set the value to false
  • Default state: All marketing channels are enabled by default
  • Data opt-out: Consider making this opt-in rather than opt-out for better GDPR compliance

Powered by Upshot.ai