google-ads-api icon indicating copy to clipboard operation
google-ads-api copied to clipboard

API calls are too slow

Open neelhabib opened this issue 2 months ago • 2 comments

const { GoogleAdsApi, services } = require("google-ads-api");
const keywords = ["crypto"];
const KeywordSeed = services.KeywordSeed;
const keywordSeed = new KeywordSeed({ keywords: keywords });

console.time("keywords");

(async () => {
  const client = new GoogleAdsApi({
    client_id:
      "3131313131313131313123.apps.googleusercontent.com",
    client_secret: "3131313131313131312313",
    developer_token: "131313131313131",
  });
  const customer = client.Customer({
    customer_id: "42424242423",
    refresh_token:
      "131312312313131313131231313123131231231313",
  });
  //   await customer.keywordPlanIdeas.generateKeywordHistoricalMetrics({});
  const generateKeywordIdeaResponse = await customer.keywordPlanIdeas
    .generateKeywordIdeas({
      customer_id: customer.credentials.customer_id,
      keyword_seed: keywordSeed,
    })
    .catch((e) => console.error(e));
  console.log(generateKeywordIdeaResponse.length);

  console.timeEnd("keywords");
})();

I am generating keywords ideas. The request taking approx 30 to 45 sec to complete. Is there any way to accomplish quick results. I am using Rest API which is return within 1 to 2 seconds. Please provide solutions. Thanks

neelhabib avatar Jun 12 '24 10:06 neelhabib