Skip to main content
Solved

The most simple way to now how many time an event was fired


I need to track how many time a certain  event has been fired. 

Is it possible to get the number via Apmplitude API?

The only way I came up with is executing https://amplitude.com/api/2/events/list

then searching for the event I am interested in and than getting it  "totals" number

Is there a more simple way to accomplish this?

 

Best answer by Saish Redkar

Hey @iryna_chorna 

I see two other ways of doing this via API if that’s what your primary use case is.

Let me know if I have interpreted your use case correctly. Hope this helps.

View original
Did this topic help you find an answer to your question?

3 replies

Saish Redkar
Expert
Forum|alt.badge.img+10
  • Expert
  • 1380 replies
  • Answer
  • June 24, 2022

Hey @iryna_chorna 

I see two other ways of doing this via API if that’s what your primary use case is.

Let me know if I have interpreted your use case correctly. Hope this helps.


  • Author
  • New Member
  • 1 reply
  • June 29, 2022

@Saish Redkar , thank you! I was able to get the events number with segmentation API endpoint. 

But I’ve run into an issue:

the number of events (e.g. “series” field) is not updated when repeating API call after firing the event in the application. Is the response cached somehow? The number is updated in Amplitude UI almost immeditaly wherease API call returns old number of events. Here are more detailed steps:

  1. Execute request 
    https://amplitude.com/api/2/events/segmentation?e={ "event_type": "my_event_name"}&start=20220629&end=20220629&m=totals

    Response is as follows:

  2. {
        "data": {
            "series": [
                [
                    264
                ]
            ],
            "seriesCollapsed": [
                [
                    {
                        "setId": "",
                        "value": 264
                    }
                ]
            ],
            "seriesLabels": [
                0
            ],
            "xValues": [
                "2022-06-29"
            ]
        },
        "timeComputed": 1656512876764,
        "wasCached": true,
        "cacheFreshness": "FRESH",
        "novaRuntime": 101,
        "novaRequestDuration": 184,
        "novaCost": 0,
        "throttleTime": 0,
        "minSampleRate": 1.0,
        "transformationIds": [],
        "backend": "novaV2",
        "realtimeDataMissing": false,
        "timedOutRealtimeData": false,
        "missedCacheAndNotComputed": false,
        "partialMergedAndNewUserInformation": false,
        "prunedResult": false,
        "hitChunkGroupByLimit": false,
        "subcluster": 6,
        "millisSinceComputed": 554841,
        "queryIds": [
            "lD3O7HB2Oy"
        ]
    }
    1. Go to the app, fire event (open a page)
    2. Repeat the request from step1. Here I expect “series” to have value 265, but it’s still 264

What could be a reason for that? Thank you in advance


Saish Redkar
Expert
Forum|alt.badge.img+10

This could be happening due to caching.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings