<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tallydata</title>
    <description>The latest articles on DEV Community by Tallydata (tallydata).</description>
    <link>https://dev.to/tallydata</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F16018%2Fda0687ce-6077-4027-ad93-ab1650e03153.png</url>
      <title>DEV Community: Tallydata</title>
      <link>https://dev.to/tallydata</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tallydata"/>
    <language>en</language>
    <item>
      <title>Why Google Trends data pipelines break, and how to compare keywords reliably</title>
      <dc:creator>Mohamed Elshahed</dc:creator>
      <pubDate>Mon, 16 Nov 2026 08:15:51 +0000</pubDate>
      <link>https://dev.to/tallydata/why-google-trends-data-pipelines-break-and-how-to-compare-keywords-reliably-2445</link>
      <guid>https://dev.to/tallydata/why-google-trends-data-pipelines-break-and-how-to-compare-keywords-reliably-2445</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I build and sell a Google Trends scraper on Apify. The last section is about it; everything before applies to any Trends pipeline, including your own.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you pull Google Trends data on a schedule, you know the pattern: a run fails with a 429, the next one works, and a rerun of the same query returns slightly different numbers. Google's own Trends API is an invite-only alpha, and pytrends, the library most tutorials still use, is archived on GitHub. So Trends pipelines run on scrapers, and scrapers break.&lt;/p&gt;

&lt;p&gt;Before building our scraper, we counted what goes wrong. Across 599 GitHub issues and 324 Stack Overflow questions about Trends libraries, 194 were "it stopped working" and 115 were about 429 errors, blocking and proxy cost. No request for a data feature came close.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Trends pipelines break
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Refusals come in waves
&lt;/h3&gt;

&lt;p&gt;The usual failure is a 429, "too many requests", and it rarely comes alone. In a 24-hour test in October, 37 of the 46 failed queries came from just 3 runs. In 2 of 51 scheduled runs, every query failed at the same moment, across different keywords and countries. During a load test on 1 November we watched a wave live: 8 refusals in 8 seconds, then nothing. The 429 gives no hint how long to wait.&lt;/p&gt;

&lt;p&gt;One failed run does not prove your setup is broken. Log the time of every failure: if they cluster, you are looking at waves.&lt;/p&gt;

&lt;h3&gt;
  
  
  The top of the hour is busy
&lt;/h3&gt;

&lt;p&gt;An earlier build of ours ran every 10 minutes for two days (2 to 4 November). Runs at minute :00 failed 4 times in 50 (8%). Runs at all other minutes failed once in 247 (0.4%). Our guess is that many scheduled jobs start on the hour. The fix is free: schedule at :07 or :23.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runs that hang
&lt;/h3&gt;

&lt;p&gt;A refusal fails fast. A request that never answers is worse, because the run waits until something ends it. In our early tests, 5 of 12 failures were hangs.&lt;/p&gt;

&lt;p&gt;Set a timeout on every run that fits the job, so a hang becomes a failure you can see and retry. For comparison, the official Google Trends Actor on Apify has a default timeout of 7 days (604,800 seconds). In the 30 days to 11 November 2026, 13.4% of its runs timed out; the public stats don't say why.&lt;/p&gt;

&lt;h3&gt;
  
  
  Empty answers
&lt;/h3&gt;

&lt;p&gt;Sometimes Google answers with nothing. In our 24-hour test, 6 of 193 low-volume queries came back as an all-zero series, against 0 of 284 high-volume ones. For a niche keyword, "no data" is often the real answer. Store it as an empty result, separate from failures, or your success numbers will mix the two.&lt;/p&gt;

&lt;h3&gt;
  
  
  Google samples the data
&lt;/h3&gt;

&lt;p&gt;This one is not a failure, and it confuses people the most. Google Trends &lt;a href="https://support.google.com/trends/answer/4365533" rel="noopener noreferrer"&gt;works from a sample of searches&lt;/a&gt;, so two requests for the same thing can return different numbers.&lt;/p&gt;

&lt;p&gt;We sent the same request twice at the same moment: "electric bike", US, past 12 months, weekly points (7 November 2026). In 49 of the 52 full weeks, the two values differed by 4 points or less on the 0–100 scale. The largest gap was 11, the mean 1.6. The top 10 related queries were the same 10 in both runs, with two pairs swapped. Same code, same moment, different numbers. Reruns 8 hours apart stayed close too (5 keywords: Spearman correlation 0.966 or higher, median absolute deviation 0 to 3 points).&lt;/p&gt;

&lt;p&gt;In practice, a pipeline that alerts on a 3-point change will alert on noise. Look at the shape over several weeks or average a few pulls, and before you call one tool wrong, check whether the gap is bigger than this noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to compare keywords so the comparison holds
&lt;/h2&gt;

&lt;p&gt;Google scales every request to its own 0–100, where 100 is the peak inside that request. Two keywords fetched separately each have their own 100, so their numbers don't compare directly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Compare inside one request.&lt;/strong&gt; Up to 5 terms in one request share one scale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Past 5 terms, use an anchor.&lt;/strong&gt; Repeat one mid-volume keyword in every group of up to 5 and compare the groups through it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hold everything else fixed.&lt;/strong&gt; Same country, time range and category for every keyword.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allow for sampling.&lt;/strong&gt; Small gaps between two keywords can flip between pulls. Read the trend, not the last point.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8fp60gu0o0uj1byvp4t5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8fp60gu0o0uj1byvp4t5.png" alt="Nike leads US search interest over 12 months; adidas, new balance, puma and reebok follow on one 0 to 100 scale." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What reliable looks like, measured
&lt;/h2&gt;

&lt;p&gt;The bar we hold our Actor to: a run finishes or fails within seconds and never hangs, and a failed or empty query is not charged. Success rate means succeeded runs divided by all runs over 30 days, from Apify's public run stats, with aborted runs shown separately and our own monitoring runs disclosed.&lt;/p&gt;

&lt;p&gt;Before release, we tested the build in production on Apify every 10 minutes for 4 days, one keyword per run, against a pass mark of 99%. "Slow case" means 95% of runs finished within that time.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Test&lt;/th&gt;
&lt;th&gt;Runs&lt;/th&gt;
&lt;th&gt;Succeeded&lt;/th&gt;
&lt;th&gt;Typical run&lt;/th&gt;
&lt;th&gt;Slow case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Production test, 6 to 10 November 2026&lt;/td&gt;
&lt;td&gt;576&lt;/td&gt;
&lt;td&gt;576 (100%)&lt;/td&gt;
&lt;td&gt;8.9 s&lt;/td&gt;
&lt;td&gt;21.5 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Published build, first night (10 to 11 November 2026)&lt;/td&gt;
&lt;td&gt;56&lt;/td&gt;
&lt;td&gt;56 (100%)&lt;/td&gt;
&lt;td&gt;8.8 s&lt;/td&gt;
&lt;td&gt;12.8 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Release candidate, side by side with the previous build&lt;/td&gt;
&lt;td&gt;299&lt;/td&gt;
&lt;td&gt;299 (100%)&lt;/td&gt;
&lt;td&gt;5.3 s&lt;/td&gt;
&lt;td&gt;10.3 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Previous build, same minutes&lt;/td&gt;
&lt;td&gt;367&lt;/td&gt;
&lt;td&gt;364 (99.2%)&lt;/td&gt;
&lt;td&gt;6.5 s&lt;/td&gt;
&lt;td&gt;19.0 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are test runs over short windows, and Google changes its limits without notice. A wide enough refusal wave will still fail runs, and a failed run counts as a failure even though it isn't charged. The 30-day number from real users goes on the Store page when we have it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Actor: compare keywords over time
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://apify.com/tallydata/google-trends-interest-over-time" rel="noopener noreferrer"&gt;Google Trends Scraper: Compare Keywords Over Time&lt;/a&gt; is the Actor we built against that bar, published by Tallydata on the Apify Store. It is unofficial and not affiliated with Google.&lt;/p&gt;

&lt;p&gt;Put up to 5 comma-separated keywords in one entry and set &lt;code&gt;isMultiple: true&lt;/code&gt;: they come back on one 0–100 scale. With &lt;code&gt;isMultiple&lt;/code&gt; off (the default), the comma stays part of the keyword. Send many entries in &lt;code&gt;searchTerms&lt;/code&gt; to run a keyword list, each with its own scale (about 7 minutes for 200 keywords).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;apify_client&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ApifyClient&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ApifyClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;APIFY_TOKEN&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"tallydata/google-trends-interest-over-time"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;run_input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"searchTerms"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"nike, adidas, puma, reebok, new balance"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"isMultiple"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"geo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"timeRange"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"today 12-m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"defaultDatasetId"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;iterate_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"searchTerm"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"interestOverTime_averages"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A compared row holds one value per keyword at each point, in the order you gave them (&lt;code&gt;"value": [46, 14]&lt;/code&gt; for &lt;code&gt;"iphone, samsung"&lt;/code&gt;), plus the averages in &lt;code&gt;interestOverTime_averages&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Each result also has interest by country or subregion and top and rising related queries. The Actor takes the input of the official &lt;code&gt;apify/google-trends-scraper&lt;/code&gt; and returns the same output field names. Not supported: related topics, city or metro data, &lt;code&gt;extendOutputFunction&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It costs $0.015 per keyword with data (less on higher Apify plans; a 5-keyword comparison counts as 5), plus $0.005 per keyword when related queries come back. Failed or empty queries are not charged, though Apify's run-start line still appears on the bill. For long lists on higher plans, the official Actor's per-result price is lower.&lt;/p&gt;

&lt;p&gt;For context, from Apify's public stats for the 30 days to 11 November 2026: the official Actor succeeded on 67.5% of its runs (20,622 of 30,564), with most of the rest aborted or timed out. &lt;code&gt;data_xplorer/google-trends-fast-scraper&lt;/code&gt; succeeded on 99.3% (48,966 of 49,287), at one keyword per run and about $0.027 per keyword on the Free plan. Those stats cover every user's runs and inputs, so they don't compare one to one with our tests. Both are good choices for some jobs; check the numbers on the day you choose.&lt;/p&gt;

&lt;p&gt;For AI agents, add the Apify MCP server with the Actor preloaded and keep calls to 5 queries or fewer, inside the usual 30-second wait:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://mcp.apify.com?tools=actors,docs,tallydata/google-trends-interest-over-time
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Python and curl examples, a Colab notebook and the output check against the official Actor are on GitHub: &lt;a href="https://github.com/tallydata/google-trends-actor-examples" rel="noopener noreferrer"&gt;https://github.com/tallydata/google-trends-actor-examples&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If your Trends pipeline fails at the top of the hour or in waves, I would like to hear when. The comments are open.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was written with the help of AI.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>seo</category>
      <category>api</category>
    </item>
  </channel>
</rss>
