Transfer data by batch requests

  • 21 May 2019
  • 1 reply


Hello, At the moment, more than a month, we can’t correctly transfer data to Mixpanel analytics system.

We can transfer data only by batch requests.

Every morning we get a fresh upload from our backend about the user's actions for the previous day.

Question 1: How to transfer events older than 5 days? For example, if an event in the json file that I upload occurred more than five days ago (timestamp), then responce 0 comes (the event was not transmitted). We are currently sending batch requests to

I read in documentation that events older than 5 days should be sent to / import, but with a different address the situation is completely the same. The only place I was able to transfer data older than 5 days was / engage, using the $ append method.

My json string, which i send is:

{"event": "$transaction", "properties": {"login": "TEST_user", "tarif": "T3", "periodFrom": "2016-09-01", "periodTo": "2016-12-01", "transaction_type": "Manual", "period": "3", "error_period1": "", "error_period2": "", "distinct_id": "TEST_user", "time": 1557848379, "token": "f5bf5755ef7b19231998335be2XXXXX", "$insert_id": "1230", "event_id": "8368", "$amount": "15120.00", "source": "sberbank", "destination": "iprojects", "vatable": "1", "rebillable": "0", "transaction_id": "8368"}}

And if "time" is earlier than 5 days, it's sends normally. Tell me, how do we solve the issue with historical data? Remember, we can only use batch requests.

Question 2: Is it possible to track revenue and track transaction events automatically? For example, to transfer both revenue and auto-increment about the number of transactions and a specific transaction event with one's own properties in one JSON line. at the moment, if I am making a batch request of the form: (By the way, it is JSON above that is the only event that I managed to send over 5 days later);

{ "$ append": { "$ transactions": { "$ time": "2019-05-21T09: 00: 00", "$ amount": 40 } }, "$ token": "f5bf5755ef7b19231998335be23XXXXX", "$ distinct_id": "TEST_user" }

, then the total revenue figure and the average per user in the revenue section simply change. And there is no event with this transaction, so i can't work with periodicity of these transactions and so on.

I need to have a separate event in the user card, with its properties and the amount of payment, so that you can track the frequency of payments. And I need to transfer this in one JSON string.

Question 3. Do we lose something in terms of functionality, due to the fact that we can only use batch queries? I still do not fully understand how to transfer the property increment (+ $ 50 / $ -30 and so on) using a JSON batch query.

THANKS TO ALL IN ADVANCE! We have to make decision (buy Mixpanel or Amplitude), but Mixpanel says that i'm on a free plan and there no support :)
Mixpanel, what should my buying decision be based on? Not the best approach, I think.


Best answer by frank-bryant 22 May 2019, 21:00

View original

1 reply

Userlevel 1

Hey @SanchoKrancho!

In the past, I have imported events older than 5 days old using Mixpanel’s using this article import API endpoint. There are somethings to keep in mind that we learned along the way of trying. I have noted them below to help you along the way.

  1. One of the prerequisites to using the import API endpoint is that you must specify a timestamp in the past for each event that you're importing. This timestamp is a unix epoch style timestamp in UTC that tells Mixpanel when the was event fired.
  2. Another pre perquisite is that you must initialize the Mixpanel API library prior to running the import API endpoint.
  3. The account owner needs to request the import.
  4. The “user_id" field that you have must represent the same "distinct_id" that you're using in Mixpanel. This is to keep track of your users and avoid a distinct_id discrepancies.
  5. I would test out your import on a dummy project prior to importing your data into your main project.
  6. Lastly, I wanted to pass along this Help Center article which provides additional detail about importing events into Mixpanel.

Regarding tracking revenue, I havent personally used this yet but it also looks there is documentation here to to help you set that up Also, in regards to the number of transactions and keeping a count on it, maybe their incrementing numeric property might be helpful?

I hope our trail and error helps you out!