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

Customer report showing previous day's data when date_constant is 'TODAY' #483

Open
brunobely opened this issue Jan 6, 2024 · 0 comments

Comments

@brunobely
Copy link

I have a service that queries customer reports every 10 minutes on a cron job, and I've been noticing data from previous days recently started to "leak" into the next day. Upon further inspection, it seems that there's 2 points at which the report shows data from the previous day: slightly past midnight and at 3am. I was wondering if this is a known issue and if anyone has had success handling it properly without discarding useful data.

I call the report like this

    const apiClient = new GoogleAdsApi({
      client_id: GOOGLE_ADS_API_CLIENT_ID,
      client_secret: GOOGLE_ADS_API_CLIENT_SECRET,
      developer_token: GOOGLE_ADS_API_DEVELOPER_TOKEN,
    });

    const customer = apiClient.Customer({
      customer_id: customerId,
      refresh_token: refreshToken,
      login_customer_id: loginCustomerId,
    });
    
    const rows = await customer.report({
      entity: 'ad_group_ad',
      attributes: [
        'customer.time_zone',
        'campaign.id',
        'ad_group.id',
        'ad_group_ad.ad.id',
        'campaign.name',
        'ad_group.name',
        'ad_group_ad.ad.name',
      ],
      metrics: [
        'metrics.cost_micros',
        'metrics.clicks',
        'metrics.impressions',
      ],
      date_constant: 'TODAY',
    });

Even though I'm requesting data for 'TODAY', I still see data from the previous day at midnight and 3am. My first instinct was to look for a field in the query that would tell me the date for the data returned, but I couldn't find any such field. Does it exist? Otherwise, is there a way to guarantee that the report will only return today's data?

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

1 participant