PHP AdWords API v201809 - How to set CUSTOM_DATE using ReportQueryBuilder?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I used the example found here: https://developers.google.com/adwords/api/docs/samples/php/reporting#download-a-criteria-performance-report-with-awql



My question is referencing the part of the code where the query is built using the ReportQueryBuilder. How would I set a custom date here:



$query = (new ReportQueryBuilder())
->select([
'CampaignId',
'AdGroupId',
'Id',
'Criteria',
'CriteriaType',
'Impressions',
'Clicks',
'Cost'
])
->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
->where('Status')->in(['ENABLED', 'PAUSED'])
->duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS)
->build();


After searching how to proceed, I found that it's necessary to change the duringDateRange line to:



->duringDateRange(ReportDefinitionDateRangeType::CUSTOM_DATE)


But where would I put my actual date range, and in what format?



NOTE - I'm using the AdWords API v201809 libraries. No prior version solutions please.










share|improve this question





























    0















    I used the example found here: https://developers.google.com/adwords/api/docs/samples/php/reporting#download-a-criteria-performance-report-with-awql



    My question is referencing the part of the code where the query is built using the ReportQueryBuilder. How would I set a custom date here:



    $query = (new ReportQueryBuilder())
    ->select([
    'CampaignId',
    'AdGroupId',
    'Id',
    'Criteria',
    'CriteriaType',
    'Impressions',
    'Clicks',
    'Cost'
    ])
    ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
    ->where('Status')->in(['ENABLED', 'PAUSED'])
    ->duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS)
    ->build();


    After searching how to proceed, I found that it's necessary to change the duringDateRange line to:



    ->duringDateRange(ReportDefinitionDateRangeType::CUSTOM_DATE)


    But where would I put my actual date range, and in what format?



    NOTE - I'm using the AdWords API v201809 libraries. No prior version solutions please.










    share|improve this question

























      0












      0








      0








      I used the example found here: https://developers.google.com/adwords/api/docs/samples/php/reporting#download-a-criteria-performance-report-with-awql



      My question is referencing the part of the code where the query is built using the ReportQueryBuilder. How would I set a custom date here:



      $query = (new ReportQueryBuilder())
      ->select([
      'CampaignId',
      'AdGroupId',
      'Id',
      'Criteria',
      'CriteriaType',
      'Impressions',
      'Clicks',
      'Cost'
      ])
      ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
      ->where('Status')->in(['ENABLED', 'PAUSED'])
      ->duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS)
      ->build();


      After searching how to proceed, I found that it's necessary to change the duringDateRange line to:



      ->duringDateRange(ReportDefinitionDateRangeType::CUSTOM_DATE)


      But where would I put my actual date range, and in what format?



      NOTE - I'm using the AdWords API v201809 libraries. No prior version solutions please.










      share|improve this question














      I used the example found here: https://developers.google.com/adwords/api/docs/samples/php/reporting#download-a-criteria-performance-report-with-awql



      My question is referencing the part of the code where the query is built using the ReportQueryBuilder. How would I set a custom date here:



      $query = (new ReportQueryBuilder())
      ->select([
      'CampaignId',
      'AdGroupId',
      'Id',
      'Criteria',
      'CriteriaType',
      'Impressions',
      'Clicks',
      'Cost'
      ])
      ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
      ->where('Status')->in(['ENABLED', 'PAUSED'])
      ->duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS)
      ->build();


      After searching how to proceed, I found that it's necessary to change the duringDateRange line to:



      ->duringDateRange(ReportDefinitionDateRangeType::CUSTOM_DATE)


      But where would I put my actual date range, and in what format?



      NOTE - I'm using the AdWords API v201809 libraries. No prior version solutions please.







      php google-adwords






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 14:38









      LatentDenisLatentDenis

      1,30322354




      1,30322354
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Unfortunately the php v201809 library was implemented a bit differently. To resolve this, replace the duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS) call with during($startDate, $endDate)



          Your function will look something like this:



          $startDate = date('Ymd', strtotime('2 days ago'));
          $endDate = date('Ymd', strtotime('3 days ago'));

          $query = (new ReportQueryBuilder())
          ->select([
          'CampaignId',
          'AdGroupId',
          'Id',
          'Criteria',
          'CriteriaType',
          'Impressions',
          'Clicks',
          'Cost'
          ])
          ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
          ->where('Status')->in(['ENABLED', 'PAUSED'])
          ->during($startDate, $endDate)
          ->build();





          share|improve this answer
























          • Thanks! Works like a charm!

            – LatentDenis
            Jan 24 at 14:51











          • how about a specific date in the past?

            – silent_coder14
            Feb 22 at 19:25











          • @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

            – Solomon A.
            Feb 23 at 20:24














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54041036%2fphp-adwords-api-v201809-how-to-set-custom-date-using-reportquerybuilder%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Unfortunately the php v201809 library was implemented a bit differently. To resolve this, replace the duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS) call with during($startDate, $endDate)



          Your function will look something like this:



          $startDate = date('Ymd', strtotime('2 days ago'));
          $endDate = date('Ymd', strtotime('3 days ago'));

          $query = (new ReportQueryBuilder())
          ->select([
          'CampaignId',
          'AdGroupId',
          'Id',
          'Criteria',
          'CriteriaType',
          'Impressions',
          'Clicks',
          'Cost'
          ])
          ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
          ->where('Status')->in(['ENABLED', 'PAUSED'])
          ->during($startDate, $endDate)
          ->build();





          share|improve this answer
























          • Thanks! Works like a charm!

            – LatentDenis
            Jan 24 at 14:51











          • how about a specific date in the past?

            – silent_coder14
            Feb 22 at 19:25











          • @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

            – Solomon A.
            Feb 23 at 20:24


















          1














          Unfortunately the php v201809 library was implemented a bit differently. To resolve this, replace the duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS) call with during($startDate, $endDate)



          Your function will look something like this:



          $startDate = date('Ymd', strtotime('2 days ago'));
          $endDate = date('Ymd', strtotime('3 days ago'));

          $query = (new ReportQueryBuilder())
          ->select([
          'CampaignId',
          'AdGroupId',
          'Id',
          'Criteria',
          'CriteriaType',
          'Impressions',
          'Clicks',
          'Cost'
          ])
          ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
          ->where('Status')->in(['ENABLED', 'PAUSED'])
          ->during($startDate, $endDate)
          ->build();





          share|improve this answer
























          • Thanks! Works like a charm!

            – LatentDenis
            Jan 24 at 14:51











          • how about a specific date in the past?

            – silent_coder14
            Feb 22 at 19:25











          • @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

            – Solomon A.
            Feb 23 at 20:24
















          1












          1








          1







          Unfortunately the php v201809 library was implemented a bit differently. To resolve this, replace the duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS) call with during($startDate, $endDate)



          Your function will look something like this:



          $startDate = date('Ymd', strtotime('2 days ago'));
          $endDate = date('Ymd', strtotime('3 days ago'));

          $query = (new ReportQueryBuilder())
          ->select([
          'CampaignId',
          'AdGroupId',
          'Id',
          'Criteria',
          'CriteriaType',
          'Impressions',
          'Clicks',
          'Cost'
          ])
          ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
          ->where('Status')->in(['ENABLED', 'PAUSED'])
          ->during($startDate, $endDate)
          ->build();





          share|improve this answer













          Unfortunately the php v201809 library was implemented a bit differently. To resolve this, replace the duringDateRange(ReportDefinitionDateRangeType::LAST_7_DAYS) call with during($startDate, $endDate)



          Your function will look something like this:



          $startDate = date('Ymd', strtotime('2 days ago'));
          $endDate = date('Ymd', strtotime('3 days ago'));

          $query = (new ReportQueryBuilder())
          ->select([
          'CampaignId',
          'AdGroupId',
          'Id',
          'Criteria',
          'CriteriaType',
          'Impressions',
          'Clicks',
          'Cost'
          ])
          ->from(ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT)
          ->where('Status')->in(['ENABLED', 'PAUSED'])
          ->during($startDate, $endDate)
          ->build();






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 24 at 5:42









          Solomon A.Solomon A.

          44125




          44125













          • Thanks! Works like a charm!

            – LatentDenis
            Jan 24 at 14:51











          • how about a specific date in the past?

            – silent_coder14
            Feb 22 at 19:25











          • @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

            – Solomon A.
            Feb 23 at 20:24





















          • Thanks! Works like a charm!

            – LatentDenis
            Jan 24 at 14:51











          • how about a specific date in the past?

            – silent_coder14
            Feb 22 at 19:25











          • @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

            – Solomon A.
            Feb 23 at 20:24



















          Thanks! Works like a charm!

          – LatentDenis
          Jan 24 at 14:51





          Thanks! Works like a charm!

          – LatentDenis
          Jan 24 at 14:51













          how about a specific date in the past?

          – silent_coder14
          Feb 22 at 19:25





          how about a specific date in the past?

          – silent_coder14
          Feb 22 at 19:25













          @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

          – Solomon A.
          Feb 23 at 20:24







          @silent_coder14, You would make the start date the same as the end date. For November 25th, 2018: $startDate = date('20181125'); $endDate = $startDate;

          – Solomon A.
          Feb 23 at 20:24






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54041036%2fphp-adwords-api-v201809-how-to-set-custom-date-using-reportquerybuilder%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas