---
schema_version: "1"
id: 685f434f2fac5deef7b8b5e89c0b57e8d1da16361ec5296acc7cf56809a3d0a1
title: Tracking Data Preprocessor (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_tracking_data_preprocessor.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_tracking_data_preprocessor.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 0272d21f16ccca185f2d298e0baac7c08f6e987dcadb167e4938ef62a900cad3
description: For the managed package runtime, before the tracking service executes its own logic, it calls any interface implementations named TrackOmniScript or TrackCard, enabling you to preprocess tracking data. For example, this implementation uses the customer ID submitted by an Omniscript to add customer detail to the event data.
products:
  - Omnistudio
release: "264"
---
# Tracking Data Preprocessor (Managed Package)

For the managed package runtime, before the tracking service executes its own logic, it calls any interface implementations named TrackOmniScript or TrackCard, enabling you to preprocess tracking data. For example, this implementation uses the customer ID submitted by an Omniscript to add customer detail to the event data.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

```
global class VlocityDemoTrackOmniscript implements vlocity_cmt.VlocityOpenInterface {
    global Boolean invokeMethod( String methodName, Map<String,Object> inputMap, Map<String,Object> outMap, Map<String,Object> options ) {
        Boolean success = true;
        string errors = 'OK';
        try {
            if( methodName == 'processTracking' ){
                processTrackingEvent( (List<Map<String, Object>>)inputMap.get('trackingDataList'), outMap );
            }
        } catch ( Exception e ) {
            errors = e.getMessage();
            success = false;
            System.debug( '##### errors: ' + errors );
        }
        return true;
    }
    /**
    * Process the tracking events
    */
    void processTrackingEvent( List<Map<String, Object>> trackingDataList, Map<String, Object> outMap ){
        // Get the current users Id from the input JSON...
        Id userId = (Id)trackingDataList[0].get('UserId');
        // Get the users details to add to the tracking data...
        User currentUser = [SELECT Id, FirstName, LastName, Profile.Name, UserRole.Name FROM User WHERE Id = :userId];
        // Iterate through the tracking entries and add the User's details...
        for ( Map<String, Object> trackingEvent : trackingDataList ){
            trackingEvent.put( 'UserFirstName', currentUser.FirstName );
            trackingEvent.put( 'UserLastName', currentUser.LastName );
            trackingEvent.put( 'UserProfile', currentUser.Profile.Name );
            trackingEvent.put( 'UserRole', currentUser.UserRole.Name );
        }
        outMap.put( 'trackingDataList', trackingDataList );
    }
}
```