If you have a MonsterInsights Pro or Agency, you have access to Site Notes.
They’re a great way to automagically connect your traffic reports to ‘things’ you’ve done on your site. The problem is that Site Notes are, by default, manual. To automate them, you need yet another plugin.
Now to a degree, this makes sense. While the out of the box code is pretty clearcut, there’s one ‘catch’ and its categories.
The Basic Call
The actual code to make a note is pretty simple:
$note_args = array(
'note' => 'Title,
'author_id' => 'author,
'date' => 'date',
'category_id' => 1, // Where 1 is a category ID
'important' => [true|false],
);
monsterinsights_add_site_note( $note_args );
But as I mentioned, category_id
is the catch. There isn’t actually an interface to know what those IDs are. The automator tools hook in and set that up for you
Thankfully I know CLI commands and I can get a list:
$ wp term list monsterinsights_note_category
+---------+------------------+-----------------+-----------------+-------------+--------+-------+
| term_id | term_taxonomy_id | name | slug | description | parent | count |
+---------+------------------+-----------------+-----------------+-------------+--------+-------+
| 850 | 850 | Blog Post | blog-post | | 0 | 0 |
| 851 | 851 | Promotion | promotion | | 0 | 0 |
| 849 | 849 | Website Updates | website-updates | | 0 | 0 |
+---------+------------------+-----------------+-----------------+-------------+--------+-------+
But I don’t want to hardcode the IDs in.
There are a couple ways around this, thankfully. WordPress has a function called get_term_id()
which lets you search by the slug, name, or ID. Since the list of categories shows the names, I can grab them!

That means I can get the term ID like this:
$term = get_term_by( 'name', 'Blog Post', 'monsterinsights_note_category' );
Now the gotcha here? You can’t rename them or you break your code.
Example for New Posts
Okay so here’s how it looks for a new post:
add_action( 'publish_post', 'create_site_note_on_post_publish', 10, 2 );
function create_site_note_on_post_publish( $post_ID, $post ) {
if ( function_exists( 'monsterinsights_add_site_note' ) ) {
return;
}
if ( $post->post_type !== 'post' ) {
return;
}
$post_title = $post->post_title;
$term = get_term_by( 'name', 'Blog Post', 'monsterinsights_note_category' );
// Prepare the site note arguments
$args = array(
'note' => 'New Post: ' . sanitize_text_field( $post_title ),
'author_id' => $post->post_author,
'date' => $post->post_date,
'category_id' => $term->term_id,
'important' => false
);
monsterinsights_add_site_note( $args );
}
See? Pretty quick.