> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-lsapi-1779323176-451247e.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google trends integration

> Integrate with the Google trends tool using LangChain JavaScript.

The Google Trends Tool allows your agent to utilize the Google Trends API from SerpApi to retrieve and analyze search interest data.
This can be useful for understanding trending topics, regional search interest, and historical popularity of search terms.

For API details see the [Google Trends API documentation](https://serpapi.com/google-trends-api)

SerpApi caches queries, so the first query will be slower while subsequent identical queries will be fast.
Occasionally, related queries will not work while interest over time will be fine. You can [check your query in the SerpApi playground](https://serpapi.com/playground?engine=google_trends\&q=monster\&data_type=RELATED_QUERIES).

## Setup

To use this tool, you will need to configure access to the Google Trends API from SerpApi.

Get an API key from [SerpApi](https://serpapi.com/users/sign_in)

Then, set your API key as `process.env.SERPAPI_API_KEY` or pass it in as an `apiKey` constructor argument.

## Usage

<Tip>
  See [this section for general instructions on installing LangChain packages](/oss/javascript/langchain/install).
</Tip>

```bash npm theme={null}
npm install @langchain/openai @langchain/community @langchain/core
```

```typescript theme={null}
import { SERPGoogleTrendsTool } from "@langchain/community/tools/google_trends";

export async function run() {
  const tool = new SERPGoogleTrendsTool();

  const res = await tool.invoke("Monster");

  console.log(res);
}
```

## Related

* Tool [conceptual guide](/oss/javascript/langchain/tools)
* Tool [how-to guides](/oss/javascript/langchain/tools)

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/tools/google_trends.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
