Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 21, 2025

This PR creates a new separate destination called snap-conversions-v3 with enhanced functionality for Snapchat Conversions API integration, while preserving the existing snap-conversions-api destination unchanged for backward compatibility.

New Destination: Snap Conversions API v3

The new destination provides four specialized actions with intelligent defaults and enhanced functionality:

1. Track Event (trackEvent)

  • Subscription: type = "track"
  • Purpose: Standard event tracking with intelligent event name mapping
  • Features: Automatically maps common Segment events to appropriate Snapchat event names

2. Track App Event (trackAppEvent)

  • Subscription: type = "track" and context.device.type != null
  • Purpose: App-specific event tracking optimized for mobile conversion tracking
  • Features: Enhanced app data and device information handling

3. Track Purchase (trackPurchase)

  • Subscription: type = "track" and event = "Order Completed"
  • Purpose: Purchase/conversion events with enhanced ecommerce data
  • Features: Optimized for Order Completed events with detailed product information

4. Sync User Data (syncUserData)

  • Subscription: type = "identify"
  • Purpose: User data synchronization without event tracking
  • Features: Updates user profiles for better ad targeting

Key Features

Intelligent Event Mapping

The trackEvent action automatically maps Segment event names to Snapchat event names:

// Segment Event → Snapchat Event Name
'Product Added'  'ADD_CART'
'Product Viewed'  'VIEW_CONTENT'
'Order Completed'  'PURCHASE'
'Checkout Started'  'START_CHECKOUT'
// ... and 10 more mappings

Batching Support

All new actions support batching up to 2,000 events per request (Snapchat API limit):

// Validates batch size and processes multiple events efficiently
export const performSnapCAPIv3Batch = async (
  request: RequestClient,
  data: ExecuteInput<Settings, Payload[]>
): Promise<ModifiedResponse<unknown>> => {
  if (payload.length > 2000) {
    throw new IntegrationError('Batch size cannot exceed 2,000 events', 'Invalid Input', 400)
  }
  // ... batch processing logic
}

Enhanced Default Mappings

Each action includes optimized default field mappings:

  • trackEvent: action_source: 'website', standard field mappings
  • trackAppEvent: action_source: 'app', app-specific mappings
  • trackPurchase: event_name: 'PURCHASE', ecommerce mappings
  • syncUserData: event_name: 'UPDATE_PROFILE', user profile mappings

Technical Implementation

  • Separate destination: New snap-conversions-v3 destination preserves existing integrations
  • Reuses enhanced field definitions for consistency and maintainability
  • Leverages existing PII hashing with SHA-256 using processHashing utility
  • Maintains original destination unchanged for full backward compatibility
  • Comprehensive error handling with proper validation for all scenarios
  • Full test coverage including unit tests, batch scenarios, and event mapping validation

Benefits

  1. Better Developer Experience: Specific actions for different use cases with intelligent defaults
  2. Improved Performance: Batching support for high-volume event processing
  3. Automatic Event Mapping: No manual event name configuration needed for common events
  4. Enhanced Targeting: Specialized actions for app events and user data synchronization
  5. Backward Compatibility: Existing integrations remain unchanged
  6. Production Ready: Comprehensive testing and error handling

This implementation provides a more intuitive and powerful interface for sending conversion data to Snapchat while maintaining full compatibility with existing integrations.

Fixes #3191.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] New Cloud Destination: Snapchat Conversions API v3 Add new actions to Snapchat Conversions API v3 destination with intelligent event mapping and batching Aug 21, 2025
@Copilot Copilot AI requested a review from varadarajan-tw August 21, 2025 13:50
Copilot finished work on behalf of varadarajan-tw August 21, 2025 13:50
@varadarajan-tw
Copy link
Contributor

@copilot you should create a separate destination called snap-conversions-v3 and not update the existing one.

Copy link
Author

Copilot AI commented Aug 21, 2025

@copilot you should create a separate destination called snap-conversions-v3 and not update the existing one.

I've addressed your feedback and created a separate destination called snap-conversions-v3 instead of updating the existing one. The original snap-conversions-api destination has been reverted to its original state, and all the new functionality (4 new actions with intelligent event mapping and batching) has been moved to the new destination.

The new destination includes:

  • All original presets and functionality
  • 4 new specialized actions (trackEvent, trackAppEvent, trackPurchase, syncUserData)
  • Intelligent event name mapping
  • Batching support up to 2,000 events per request
  • Comprehensive test coverage

This approach maintains full backward compatibility with existing integrations while providing the enhanced functionality as a separate destination option.

Commit: 818255e

@Copilot Copilot AI changed the title Add new actions to Snapchat Conversions API v3 destination with intelligent event mapping and batching Create new Snap Conversions API v3 destination with intelligent event mapping and batching Aug 21, 2025
Copilot finished work on behalf of varadarajan-tw August 21, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Cloud Destination: Snapchat Conversions API v3
3 participants