Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INVALID_TIME_WINDOW: 'The end_time can be a maximum of 7.days+1.hours after the start_time #254

Open
arammaliachi opened this issue Jun 3, 2020 · 4 comments

Comments

@arammaliachi
Copy link

The example provided at examples/active_entities.py does not work as is.

If I run it as is I am told by the inline documentation of the file that I am pulling active entities for the last day. If I examine the dict returned I see that the activity_start_time and activity_end_time do not match anything at all the 'last day'.
This is causing the end call to analytics to fail because some active entities activity_start_time and activity_end_time ranges are greater than 7 days (as calculated by the date_range function) even though I'm supposedly querying for only the last day.

Why am I getting active entities outside the last day range at all?

e.g.

if I run the script as is today 2020-06-03 I get the following active entities:

{'entity_id': 'hbvri', 'activity_start_time': '2020-05-27T23:48:58Z', 'activity_end_time': '2020-06-02T17:24:58Z', 'placements': ['ALL_ON_TWITTER']}
{'entity_id': 'hc53a', 'activity_start_time': '2020-05-27T21:21:03Z', 'activity_end_time': '2020-05-28T03:27:57Z', 'placements': ['ALL_ON_TWITTER']}
{'entity_id': 'h8nt6', 'activity_start_time': '2020-05-23T15:39:18Z', 'activity_end_time': '2020-05-23T23:36:40Z', 'placements': ['ALL_ON_TWITTER']}
{'entity_id': 'h7a76', 'activity_start_time': '2020-06-01T05:56:47Z', 'activity_end_time': '2020-06-02T17:24:56Z', 'placements': ['ALL_ON_TWITTER', 'PUBLISHER_NETWORK']}

I see active entities that begin 2020-05-27 and end 2020-05-28 which is completely out of the last day range.
This is causing the range output by the date_range function to be greater than 7 days and hence all the script fails.

@arammaliachi
Copy link
Author

@juanshishido can you advice?

@arammaliachi
Copy link
Author

Oh I think I understand now, I think activity_start_time and activity_end_time are greedy to all activity in each ad group returned meaning its range will keep growing while the ad is active... So I guess I have to query stats per day for the resulting range on the resulting line items (ad groups).

Maybe some clarification on this on the docs...

@osowskit
Copy link
Contributor

Thanks for the feedback. We recommend using the async analytics endpoints for production applications as the active range can exceed 7 days.

Maybe some clarification on this on the docs...

Do you have any suggestions?

@jojkhan
Copy link

jojkhan commented Oct 26, 2022

what to do if we want to access data of lifetime or with respect to year'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants