How to retroactively track events for users via CSV (+ event parameters)

Our CSV uploader supports importing of aggregated historical events data per user: count, first occurrence, last occurrence and value. It uses the setUserAttributes API under the hood. See how to prepare such a file here.

If you also need to import event parameters with those events, the approach is different and requires CSV upload through our API. We will also be using the track API to track each event occurrence (backdated), instead of just import aggregate data for each user.


Example CSV format:



  • Required columns are userId, event and time. Value can be used where applicable. CurrencyCode is only needed for monetary purchase events.

  • Events older than 365 days ago from time of import will be tracked as if they happened at the time of import. To avoid this, replace all such timestamps with a timestamp ~360 days prior the time of import. 

  • Each event occurrence must be on its own row. Multiple rows allowed with the same userId.

  • Imported events will be treated as if users tracked them organically. This will activate campaigns that use these events for triggering.

  • Events older than 7 days prior time of import will not populate in our Analytics page, but will populate normally in the Users' profiles and will be available for building Audiences.


Start the import:

  1. Upload your file into your Google Cloud Bucket. If you don't have one, contact to have one created.
  2. Replace the values in CAPITALS and execute the API call in Terminal.
    *Obtain your API keys from the Leanplum dashboard (Development > App Settings).
    curl --location --request POST '' \
    --header 'Content-Type: application/json' \
    --form 'appId="APP_KEY"' \
    --form 'clientKey="DEV_KEY"' \
    --form 'gcsBucket="BUCKET_NAME"' \
    --form 'file="FILE_NAME"' \
    --form 'action="multi"' \ --form 'defaultAction="track"'
    --form 'apiVersion="1.0.6"' \
    --form 'createJob="true"' \
  3. Monitor the progress with the getMultiResults API call below, replacing the values in CAPITALS. Once completed, it will return a URL to a file, containing the results.
    *Obtain your API keys from the Leanplum dashboard (Development > App Settings).


Contact for assistance or questions regarding this process.

Was this article helpful?
Have more questions? Submit a request