Amplitude - Data Sync

This guide is for syncing events and user properties to Aampe

👍

Estimated setup time

30 minutes

Realtime Sync

Aampe can receive user events and user properties in real-time via the following methods

  1. Aampe official destination [In Progress]
  2. Custom Webhook

Official Aampe destination in Amplitude [In Progress]

We are in process to get the official destination reviewed. Meanwhile the second method will work as an alternative

Custom Webhook to send data to Aampe

Events

  1. Go to Menu -> Data -> Destinations
  1. Click on Add Destination (+)
  2. Search for Webhook -> Select the first one (Events and User Properties) - Do not select Cohorts webhook for this integration
  1. Click on Add Destination

  2. Give the name: Aampe - Events Sync

  3. Add the following details

    1. Status: Enabled

    2. Webhook URL: https://ingestion.api.aampe.com/v1/events

    3. Headers: Add the following Header:

      1. Key: authorization
      2. Value: Bearer {api_key}

        🚧

        Important Note

        Note that you will need the API key that you can fetch from

        1. Go to: https://compose.aampe.com/system-setup/integrations/events
        2. Login using your org credentials
        3. Select Connect next to Aampe endpoint
        4. Copy the API key
        5. Paste it in place of {api_key}
        6. Sample: Bearer my_token
    4. Enable Send Events

    5. Click on Events Payload -> Customize payload

    6. Enter the following:

      <#setting number_format="0.####">
      {
        <#if input.user_id??>
        "contact_id" : "${input.user_id}",
        </#if>
        "event_name" : "${input.event_type}",
        "timestamp" : ${input.event_time?date("yyyy-MM-dd HH:mm:ss.SSSSSS")?long / 1000},
        "event_id" : "${input.event_id}",
        "metadata" : {
          "input_source": "amplitude",
          <#if input.amplitude_id??>
          "amplitude_id": "${input.amplitude_id}",
          </#if>
          <#if input.country??>
          "geo_country": "${input.country}",
          </#if>
          <#if input.region??>
          "geo_region": "${input.region}",
          </#if>
          "event_properties": {
            <#list input.event_properties?keys?filter(key -> input.event_properties[key]?has_content) as key>
              "${key}": <#if input.event_properties[key]?is_string>"${input.event_properties[key]?json_string}"<#else>${input.event_properties[key]}</#if><#sep>,</#sep>
            </#list>
          },
          "user_properties": {
            <#list input.user_properties?keys?filter(key -> input.user_properties[key]?has_content) as key>
              "${key}": <#if input.user_properties[key]?is_string>"${input.user_properties[key]?json_string}"<#else>${input.user_properties[key]}</#if><#sep>,</#sep>
            </#list>
          }
        }
      }
      
    7. Select the events you want to send (ideally all events)

    8. Keep Send Users disabled

  4. Hit Save

User Properties

We need to repeat the same steps for user properties with the following changes

  1. Name will be: Aampe - Properties Sync

  2. Webhook URL: https://ingestion.api.aampe.com/v1/properties

  3. Disable Send Events

  4. Enable Send Users and Hit Customize Payload
    Copy the following:

    <#setting number_format="0.####">
    {
      <#if input.user_id??>
      "contact_id" : "${input.user_id}",
      </#if>
      "event_name": "aampe_property_update_amplitude_identify",
      "timestamp" : ${input.event_time?date("yyyy-MM-dd HH:mm:ss.SSSSSS")?long / 1000},
      "event_id": "${input.event_id}",
      "user_properties": {
        <#if input.country??>
        "geo_country": "${input.country}",
        </#if>
        <#if input.city??>
        "geo_city": "${input.city}",
        </#if>
        <#if input.language??>
        "user_language": "${input.language}",
        </#if>
        <#if input.region??>
        "geo_region": "${input.region}",
        </#if>
        <#if input.user_properties??>
        <#list input.user_properties?keys?filter(key -> input.user_properties[key]?has_content) as key>
        "${key}": <#if input.user_properties[key]?is_string>"${input.user_properties[key]?json_string}"<#else>${input.user_properties[key]}</#if><#sep>,</#sep>
        </#list>
        </#if>
      },
      "metadata": {
        "input_source": "amplitude"
      }
    }
    

  5. Hit Save


This will complete setup of events and properties

Batch Sync

Aampe will pull events and properties data from your Amplitude instance directly at a regular cadence.

The methods available are

  1. Recurring data export to Aampe GCS bucket
  2. Recurring data export to Aampe BigQuery [Preferred]
  3. Using the Ampltiude API

Recurring data export

Setting up recurring data export - Google Cloud Bucket

  1. In Amplitude Data, click Catalog and select the Destinations tab.
  2. In the Warehouse Destination section, click Google Cloud Storage.
  3. On the Getting Started tab, select the data you'd like to export. You can Export events ingested today and moving forward, Export all merged Amplitude IDs, or both. For events, you can also specify filtering conditions to only export events that meet certain criteria.
  4. Review the Event table and Merge IDs table schemas and click Next.
  5. In the Google Cloud Credentials For Amplitude section, upload the Service Account Key file. This file must be in JSON format and will be provided by Aampe. After the account service key is uploaded, fill out the Google Cloud bucket details in the Google Cloud Bucket Details section as provided by Aampe team
  6. Click Next. Amplitude attempts a test upload to check that the entered credentials work. If the upload is successful, click Finish to complete the GCS destination configuration and activation.

Setting up recurring data export - Google Bigquery

  1. Amplitude will directly write data to the Aampe BigQuery instance
  2. In the Warehouse Destination section, click Big Query.
  3. On the Getting Started tab, select the data you'd like to export and the export's cadence. You can Export events ingested today and moving forward, Export all merged Amplitude IDs, or both. For events, you can also specify filtering conditions to only export events that meet certain criteria.
  4. Review the schemas for the Event table and the Merge IDs table and click Next.
  5. Specify the BigQuery dataset to receive your Amplitude data, and upload the service account key file. This file must be in JSON format and will be provided by Aampe
  6. Click Next. Amplitude attempts a test upload to test the credentials. If the upload is successful, click Finish to complete the BigQuery destination configuration and activation.

Amplitude export API

Aampe will pull data from the amplitude Export API

📘

This is only useful when data size is small. If data is larger you should go to Recurring data export

Requirements

  • Your Amplitude API Key and Secret Key

Getting your API keys:

  1. In your Amplitude workspace, click on Settings at the bottom left of your screen
354
  1. Select Projects from the navigation bar that opens.
  2. Select the project with the events you would like Aampe to ingest.
1455
  1. Copy your API Key and Secret Key
1449
  1. Navigate to System Settings > Integrations and select the Data Import tab
  1. Select Amplitude and add your credentials