Principle 2: Privacy as the Default Setting

Principle 2: Privacy as the Default Setting

Privacy as the default means systems should provide maximum privacy protection without requiring action from the user. This principle challenges the common practice of opt-out consent where users must actively choose privacy. Instead, privacy-protective settings should be enabled by default, with users able to consciously choose less private options if they desire additional functionality.

Implementing privacy defaults requires careful balance between functionality and protection. The system should remain useful with default settings while collecting minimal data. This often means designing features that gracefully degrade when users choose not to share certain data. For example, a recommendation system might use only anonymous browsing patterns by default, requiring explicit consent to use personal purchase history for improved recommendations.

// Privacy default configuration system
class PrivacyDefaultManager {
  constructor() {
    this.defaultSettings = {
      analytics: {
        enabled: false,
        level: 'anonymous',
        retention: '30days',
        sharing: 'none'
      },
      personalization: {
        enabled: false,
        dataTypes: [],
        crossDevice: false,
        thirdPartyEnrichment: false
      },
      communication: {
        marketing: false,
        transactional: true,
        frequency: 'minimal',
        channels: ['email']
      },
      dataSharing: {
        thirdParties: false,
        affiliates: false,
        anonymizedAnalytics: true,
        lawEnforcement: 'required-only'
      },
      security: {
        twoFactor: true,
        sessionTimeout: '30min',
        deviceTracking: false,
        loginAlerts: true
      }
    };
  }

  // Initialize user with privacy defaults
  initializeUserPrivacy(userId) {
    const userSettings = {
      userId,
      settings: JSON.parse(JSON.stringify(this.defaultSettings)),
      created: new Date().toISOString(),
      version: '1.0'
    };

    // Apply jurisdiction-specific requirements
    const jurisdiction = this.detectJurisdiction(userId);
    this.applyJurisdictionDefaults(userSettings.settings, jurisdiction);
    
    // Store settings
    this.storeUserSettings(userSettings);
    
    // Configure all systems with defaults
    this.propagateSettings(userSettings);
    
    return userSettings;
  }

  // Create privacy-preserving feature implementations
  implementPrivacyDefault(feature, settings) {
    const implementations = {
      recommendations: () => {
        if (!settings.personalization.enabled) {
          // Use only anonymous, session-based data
          return new AnonymousRecommendationEngine({
            useSessionData: true,
            useCookies: false,
            useLocalStorage: true,
            dataRetention: 'session'
          });
        } else {
          // Use personalized data with consent
          return new PersonalizedRecommendationEngine({
            dataTypes: settings.personalization.dataTypes,
            crossDevice: settings.personalization.crossDevice
          });
        }
      },
      
      analytics: () => {
        if (!settings.analytics.enabled) {
          // No analytics
          return new NullAnalytics();
        } else if (settings.analytics.level === 'anonymous') {
          // Privacy-preserving analytics
          return new PrivacyAnalytics({
            hashIP: true,
            stripUserAgent: true,
            generalizeLocation: 'country',
            excludeReferrer: true
          });
        } else {
          // Full analytics with consent
          return new FullAnalytics({
            retention: settings.analytics.retention
          });
        }
      },
      
      advertising: () => {
        if (!settings.dataSharing.thirdParties) {
          // No behavioral advertising
          return new ContextualAdvertising({
            usePageContent: true,
            useUserData: false,
            trackConversions: false
          });
        } else {
          // Targeted advertising with consent
          return new TargetedAdvertising({
            consentGiven: true
          });
        }
      }
    };

    const implementation = implementations[feature];
    return implementation ? implementation() : null;
  }

  // Graceful degradation for privacy defaults
  designGracefulDegradation(feature) {
    return {
      recommendations: {
        withData: 'Personalized recommendations based on your history',
        withoutData: 'Popular items and trending content',
        incentive: 'Enable personalization for recommendations tailored to your interests'
      },
      search: {
        withData: 'Search results ranked by your preferences',
        withoutData: 'General search results',
        incentive: 'Enable search history for more relevant results'
      },
      social: {
        withData: 'See what your friends are doing',
        withoutData: 'See general community activity',
        incentive: 'Connect your account to see friend activity'
      }
    }[feature];
  }
}

// Anonymous recommendation engine
class AnonymousRecommendationEngine {
  constructor(config) {
    this.config = config;
    this.sessionData = new Map();
  }

  getRecommendations(sessionId, context) {
    // Use only current session behavior
    const sessionBehavior = this.sessionData.get(sessionId) || {
      viewedCategories: [],
      viewedItems: [],
      searchTerms: []
    };
    
    // Generate recommendations without personal data
    const recommendations = {
      items: [],
      reason: 'Based on current browsing session'
    };
    
    // Use content similarity
    if (sessionBehavior.viewedItems.length > 0) {
      const similar = this.findSimilarItems(
        sessionBehavior.viewedItems[sessionBehavior.viewedItems.length - 1]
      );
      recommendations.items.push(...similar);
    }
    
    // Use category popularity
    if (sessionBehavior.viewedCategories.length > 0) {
      const popular = this.getPopularInCategory(
        sessionBehavior.viewedCategories[0]
      );
      recommendations.items.push(...popular);
    }
    
    // Fill with general popular items
    const generalPopular = this.getGenerallyPopular();
    recommendations.items.push(...generalPopular);
    
    return recommendations;
  }

  trackBehavior(sessionId, behavior) {
    // Only track within session
    if (!this.sessionData.has(sessionId)) {
      this.sessionData.set(sessionId, {
        viewedCategories: [],
        viewedItems: [],
        searchTerms: []
      });
    }
    
    const data = this.sessionData.get(sessionId);
    
    if (behavior.type === 'view') {
      data.viewedItems.push(behavior.itemId);
      data.viewedCategories.push(behavior.category);
    } else if (behavior.type === 'search') {
      data.searchTerms.push(behavior.term);
    }
    
    // Limit stored data
    data.viewedItems = data.viewedItems.slice(-10);
    data.viewedCategories = data.viewedCategories.slice(-5);
    data.searchTerms = data.searchTerms.slice(-5);
  }
}