Solved

Issues using the Revenue LTV REST Endpoint

  • 23 April 2021
  • 1 reply
  • 62 views

I’m currently trying to pull revenue data for specific users out of Amplitude using the Revenue LTV endpoint but getting some unexpected behavior.

Before I even added a segment definition to define specific users in the request I wanted to understand its behavior and I’m not getting the results I’d expect.

GET https://amplitude.com/api/2/revenue/ltv?start=20210415&end=20210422&m=2&i=1

Is the request I’m making. From the documentation I thought this would be the daily (i=1) TOTAL REVENUE (m=2) of our Users. However my response is essentially empty data:

{
    "data": {
        "series": [
            {
                "combined": {
                    "count"0,
                    "paid"0,
                    "r1d"0,
                    "r2d"0,
                    "r3d"0,
                    "r4d"0,
                    "r5d"0,
                     ….
This continues for every day in the range. I make the same request except change the interval to 7 and…
{
    "data": {
        "series": [
            {
                "combined": {
                    "count"1,
                    "paid"1,
                    "r1d"103057.4,
                    "r2d"217844.1,
                    "r3d"217844.1,
                    "r4d"217844.1,
                    "r5d"217844.1,
                     ….
The number 217844.1 continues for many more lines before another empty empty dictionary like before. Why is my data going from completely empty to this upon changing the interval? I can confirm there is purchase data for every day in that range.
 
I added a segment definition to try and pull data from a specific store and one again got a whole list of “0” values.
 
I was under the impression from the documentation I’d get a “count”, “paid” and “total_amount” with this data but I see no such fields.
 
Is this behavior expected and I’m just misunderstanding the purpose of the endpoint or is something wrong with the request itself? To restate: my ultimate goal is to pull the TOTAL REVENUE for a given user within a date range.
 
Any help would be appreciated, thanks!
 
 

 

 

icon

Best answer by daniel.balan 26 April 2021, 14:21

@jnazemi having a look at this I think the reason why you are getting unexpected results is because the Revenue LTV chart and end point looks at new users. So if within the selected timeframe, the revenue data is not sent by new users, then this will not be captured as a result. You might want to double check this with a Revenue LTV chart in your org. 

 

As a workaround for this, you could use the Event Segmentation end point, using the Revenue event. Link to developer docs here: https://developers.amplitude.com/docs/dashboard-rest-api#event-format 

View original

1 reply

Userlevel 4
Badge +3

@jnazemi having a look at this I think the reason why you are getting unexpected results is because the Revenue LTV chart and end point looks at new users. So if within the selected timeframe, the revenue data is not sent by new users, then this will not be captured as a result. You might want to double check this with a Revenue LTV chart in your org. 

 

As a workaround for this, you could use the Event Segmentation end point, using the Revenue event. Link to developer docs here: https://developers.amplitude.com/docs/dashboard-rest-api#event-format 

Reply