Under insights api logs, some events are failed to log with 422 error code and in details it says "timestamp must not be in the future",Insights library is configured like below in Android application
Insights.Configuration configuration =
new Insights.Configuration(5000, 5000, userToken);
Insights insights = Insights.register(GoldenScentApp.getAppContext(), AppConstants.ALGOLIA_APP_ID,
AppConstants.ALGOLIA_KEY, indexName, configuration);
insights.setMinBatchSize(1);
The event was logged with time GMT: Monday, 31 May 2021 06:03:07.048 but the time in Algolia Received at:2021-05-31T06:01:13.859Z
This problem is with algolia sdk. They send old event every time new event send. Like user click event it goes in to local db. Once 10 events limit reach they send event. So in case user send 9 event in one session; then open app after 4 day when another event log algolia will send other events too. But timestamp will be older so they log as error in algolia.
work around : Solution: Set event flushDelay to 5 sec instead of 30 second which in documentation mention as 30 min(idk why).
Related
I've recently added a Google Analytics GA4 tag to a website for the purpose of counting the currently active users. Before, I could see the number of real-time users right now (I think it had a one-minute delay, but I'm not sure).
But in the new GA4, I can only see the number corresponding to 30 minutes, which is not what I needed.
I've looked around and found an option to add a time dimension of 1 minute, but it was for the old google analytics, and it didn't seem right to me.
Not sure if it's needed to provide my code for this question, but if it's a must, then I'll add it.
Edit:
#Run a realtime report to get desired metrics.
def run_realtime_report(property_id):
#Runs a realtime report on a Google Analytics 4 property.
client = BetaAnalyticsDataClient()
#Run the request.
request = RunRealtimeReportRequest(
property=f"properties/{property_id}",
metrics=[Metric(name="activeUsers")],
)
#Parse the response.
response = client.run_realtime_report(request)
...
return activeUsers
#Run the realtime report function.
def run_sample():
global property_id
return run_realtime_report(property_id)
The number of users in the last 30 minutes in GA4 is similar to the "active users on site right now" in Universal Analytics (UA). However after about 5 minutes of inactivity, UA sometimes assesses users are no longer active on the site. This realtime report was generated with pageviews in the last 5 minutes:
After 5 minutes of inactivity, the active users on site goes to zero:
In GA4, you could recreate that calculation by specifying the minutesRange in your realtime report request. This page describes the minuteRange parameter. As a JSON request, this report will only count users who were active in the last 5 minutes:
{
"metrics": [
{
"name": "activeUsers"
}
],
"minuteRanges": [
{
"startMinutesAgo": 5,
"endMinutesAgo": 0
}
]
}
This request is different from GA4 realtime reporting which highlights the "users in last 30 minutes" as the primary realtime metric:
I've recently added a Google Analytics GA4 tag to a website for the purpose of counting the currently active users. Before, I could see the number of real-time users right now (I think it had a one-minute delay, but I'm not sure).
But in the new GA4, I can only see the number corresponding to 30 minutes, which is not what I needed.
I've looked around and found an option to add a time dimension of 1 minute, but it was for the old google analytics, and it didn't seem right to me.
Not sure if it's needed to provide my code for this question, but if it's a must, then I'll add it.
Edit:
#Run a realtime report to get desired metrics.
def run_realtime_report(property_id):
#Runs a realtime report on a Google Analytics 4 property.
client = BetaAnalyticsDataClient()
#Run the request.
request = RunRealtimeReportRequest(
property=f"properties/{property_id}",
metrics=[Metric(name="activeUsers")],
)
#Parse the response.
response = client.run_realtime_report(request)
...
return activeUsers
#Run the realtime report function.
def run_sample():
global property_id
return run_realtime_report(property_id)
The number of users in the last 30 minutes in GA4 is similar to the "active users on site right now" in Universal Analytics (UA). However after about 5 minutes of inactivity, UA sometimes assesses users are no longer active on the site. This realtime report was generated with pageviews in the last 5 minutes:
After 5 minutes of inactivity, the active users on site goes to zero:
In GA4, you could recreate that calculation by specifying the minutesRange in your realtime report request. This page describes the minuteRange parameter. As a JSON request, this report will only count users who were active in the last 5 minutes:
{
"metrics": [
{
"name": "activeUsers"
}
],
"minuteRanges": [
{
"startMinutesAgo": 5,
"endMinutesAgo": 0
}
]
}
This request is different from GA4 realtime reporting which highlights the "users in last 30 minutes" as the primary realtime metric:
I am receiving a handful of errors regarding the event timestamp. I have confirmed that I am sending a UNIX timestamp in seconds. This is what I have implemented in the front-end of our code to get the UNIX timestamp in seconds: Math.round(Date.now() / 1000)
Also, it looks like less then 1% of the events are affected for each event created, so that's why I'm a bit confused and not sure how to resolve these errors.
Error message:
The timestamp for the InitiateCheckout events sent from your server is in the future. Timestamps are metadata sent alongside each event you send from your server and they represent the time of day when an event actually occurred. For example: the time that a customer made a purchase on your website. All timestamps should represent a point in time that occurred within the last 7 days"
Click here to see a screenshot of the errors
Has anyone encountered these type of errors? If so, any advice on how to resolve them?
I am not sure how to go about this
We have a daily bonus system working on date basis. Every date in your local time, you have right to take 1 daily bonus. Ex: If you get daily bonus on 12 July, you will get right to take next bonus on date 13 July without depending on time.
I would like to create push notification for users, but i could not sort it out how to do it?
My previous tries:
1- Whenever player gets daily bonus, i tried to create notification for the next day at 8 pm in her local time.
Problem: If player takes bonus on the next day before 8 pm, i could not delete previously created notification, because there is no delete function for Unity. I also tried collapse_id to deal with it, but collapse_id do not stop sending the notification, just updates notification info with the last one when it is received.
2- I created a tag which is the date when bonus collected, it is something like "2018-07-12". I tried creating a user group who compares these tag with the "today's date"
Problem: there is no such thing like todays date you had to enter it as value, so you can do this by entering console changing date and sending notification and you need to do it everyday.
How can I create such notification system?
Thanks.
Hasan
There are 2 options to do this with OneSignal.
1 - You can cancel the notification if the user already took the bonus.
You can use something like this to make the cancel request:
string url = ""https://onesignal.com/api/v1/notifications/"" + notificationId.ToString() + ""?app_id="" + s_appId;
WebRequest request = WebRequest.Create(url);
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
request.Method = ""DELETE"";
request.GetResponse();
2 - If you are tracking this on your own CRM or database, then you can save the OneSignal PlayerID to the database and target device with the API.
First, get the playerID with the SDK: https://documentation.onesignal.com/docs/unity-sdk#section--getpermissionsubscriptionstate-
Then you can send this data to your CRM or database: https://documentation.onesignal.com/docs/internal-database-crm
You can then use include_player_ids on the create notification REST API POST call https://documentation.onesignal.com/reference#section-send-to-specific-devices
If you want to go the tagging option, you should use a timestamp and then target with the API and filters https://documentation.onesignal.com/reference#section-send-to-users-based-on-filters
You should never put your OneSignal REST API key within your app. This needs to be kept private.
Using the Graph API Explorer, and using GET /me/inbox, I can get a list of messages.
I was wondering how to limit them to messages from the past day, for example?
You can use time based paging this way:
me/inbox?since=1372395600
It relies on the updated_time (unix timestamp) parameter of an inbox thread. This way you could get all the threads updated with a message at a time since yesterday, for example.