Skip to main content
Glama

get-clicks

Analyze and track outbound click activity from your WordPress site by specifying a URL, credentials, time period, and limit. Optimize links and monitor user behavior effectively.

Instructions

View a site's outbound clicks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of click items to return
passwordYesWordPress application password
periodNoTime period for stats
siteIdYesWordPress site ID
siteUrlYesWordPress site URL
usernameYesWordPress username

Implementation Reference

  • src/index.ts:1601-1650 (registration)
    Registration of the 'get-clicks' tool, including schema and inline handler function.
    server.tool( "get-clicks", "View a site's outbound clicks", { siteUrl: z.string().url().describe("WordPress site URL"), username: z.string().describe("WordPress username"), password: z.string().describe("WordPress application password"), siteId: z.number().describe("WordPress site ID"), period: z.enum(["day", "week", "month", "year"]).optional().describe("Time period for stats"), limit: z.number().min(1).max(100).optional().describe("Maximum number of click items to return"), }, async ({ siteUrl, username, password, siteId, period = "week", limit = 10 }) => { try { const clicksData = await makeWPRequest<any>({ siteUrl, endpoint: `sites/${siteId}/stats/clicks`, auth: { username, password }, params: { period, limit } }); // Format will depend on the actual API response const clicksText = Array.isArray(clicksData.clicks) && clicksData.clicks.length > 0 ? clicksData.clicks.map((click: any) => `${click.name || click.url || "Unknown URL"} Clicks: ${click.clicks || 0} URL: ${click.url || "No URL"} ---` ).join("\n") : "No outbound clicks found"; return { content: [ { type: "text", text: `Outbound Clicks for site #${siteId} (${period}):\n\n${clicksText}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving clicks data: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );
  • The handler function that executes the tool logic: fetches outbound clicks stats from Jetpack Stats API endpoint `sites/${siteId}/stats/clicks`, formats the response, and returns it as text content.
    async ({ siteUrl, username, password, siteId, period = "week", limit = 10 }) => { try { const clicksData = await makeWPRequest<any>({ siteUrl, endpoint: `sites/${siteId}/stats/clicks`, auth: { username, password }, params: { period, limit } }); // Format will depend on the actual API response const clicksText = Array.isArray(clicksData.clicks) && clicksData.clicks.length > 0 ? clicksData.clicks.map((click: any) => `${click.name || click.url || "Unknown URL"} Clicks: ${click.clicks || 0} URL: ${click.url || "No URL"} ---` ).join("\n") : "No outbound clicks found"; return { content: [ { type: "text", text: `Outbound Clicks for site #${siteId} (${period}):\n\n${clicksText}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving clicks data: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
  • Input schema using Zod for validating parameters: siteUrl, username, password, siteId, period (optional), limit (optional).
    siteUrl: z.string().url().describe("WordPress site URL"), username: z.string().describe("WordPress username"), password: z.string().describe("WordPress application password"), siteId: z.number().describe("WordPress site ID"), period: z.enum(["day", "week", "month", "year"]).optional().describe("Time period for stats"), limit: z.number().min(1).max(100).optional().describe("Maximum number of click items to return"), },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prathammanocha/wordpress-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server