remove-referrer-spam
Remove unwanted domains from your WordPress site's referrer spam list by specifying site details and the domain to exclude, ensuring cleaner analytics data.
Instructions
Unreport a referrer as spam
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain to remove from spam list | |
| password | Yes | WordPress application password | |
| siteId | Yes | WordPress site ID | |
| siteUrl | Yes | WordPress site URL | |
| username | Yes | WordPress username |
Implementation Reference
- src/index.ts:1569-1600 (handler)The handler function that executes the tool logic: sends a POST request to the WordPress Jetpack stats API endpoint `/sites/${siteId}/stats/referrers/spam/delete` with the domain to remove it from the spam list.async ({ siteUrl, username, password, siteId, domain }) => { try { const response = await makeWPRequest<any>({ siteUrl, endpoint: `sites/${siteId}/stats/referrers/spam/delete`, method: "POST", auth: { username, password }, data: { domain } }); return { content: [ { type: "text", text: `Successfully removed domain "${domain}" from spam list.`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error removing referrer from spam list: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); // 10. Get Clicks
- src/index.ts:1562-1568 (schema)Zod schema defining input parameters for the tool: siteUrl, username, password, siteId, and domain.{ 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"), domain: z.string().describe("Domain to remove from spam list"), },
- src/index.ts:1559-1601 (registration)Registration of the 'remove-referrer-spam' tool using server.tool(), including name, description, input schema, and handler function.server.tool( "remove-referrer-spam", "Unreport a referrer as spam", { 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"), domain: z.string().describe("Domain to remove from spam list"), }, async ({ siteUrl, username, password, siteId, domain }) => { try { const response = await makeWPRequest<any>({ siteUrl, endpoint: `sites/${siteId}/stats/referrers/spam/delete`, method: "POST", auth: { username, password }, data: { domain } }); return { content: [ { type: "text", text: `Successfully removed domain "${domain}" from spam list.`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error removing referrer from spam list: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); // 10. Get Clicks server.tool(