Pro Tip: tell us your comment_type

This is the first in an irregular series of tips for developers interacting with the Akismet API. Akismet is very heavily dependent on the quality of the data included in API calls. Whether you’re developing a custom implementation, or maintaining an Akismet extension for a CMS or forum application, we’d like to help you get the best results possible. Our API docs outline the basics. This series will expand on that with some simple suggestions for developers.

Our first recommendation:

Use an appropriate comment_type value.

Akismet works with almost any kind of user-submitted web content: blog comments, forum posts, blog posts, contact forms and so on. The characteristics of spam tend to vary across those type – comment spam is quite different from forum spam. So it’s important to give us some context by telling us what type of messages you’re asking Akismet to check. That’s what the comment_type value is for.

The API will accept an arbitrary string. It’s best if you use a meaningful symbolic name. We recommend the following values for common types of web-based content, which are mostly self-explanatory:

comment
For blog comment forms.
pingback
trackback
Pingbacks and trackbacks respectively.
forum-post
Forum posts and replies.
blog-post
Blog posts.
contact-form
Contact forms, inquiry forms and the like.
signup
Account signup, registration or activation.
tweet
Twitter messages

That’s not an exhaustive list. If you need to check messages that don’t fit one of those categories, it’s best to use a different comment_type value. It’s especially important not to default to comment for messages that are fundamentally different from blog comments – if you do that, you can expect to see mixed results. It’s better to be too specific than too ambiguous.

There’s no need to check with us first before using a different comment_type value – use your judgement and identify your messages as best you can. To help make sure we’re interpreting your types correctly, please drop us a line – we’d love to hear from you.