Let an AI assistant build your UTM links

You can ask an AI assistant for “a tagged link to the spring sale page for my Facebook post” and have it make the link on your site, with your presets, your formatting rules and your short links. Its links then match the ones you make by hand, instead of whatever spelling the AI comes up with.

This needs WordPress 6.9 or later, which is when the Abilities API was added to WordPress.

What the AI can do

UTM Builder adds three abilities, grouped under “UTM links”:

  • Build a UTM link (sunshine-utm/build-link) tags one page, with an optional short link from any shortener you’ve set up.
  • Build many UTM links (sunshine-utm/build-links) uses any of the Bulk Builder’s four ways (a list of links, social networks, every combination or CSV text), up to 2,000 links, and can save them as a batch you’ll find under Saved Batches.
  • List UTM presets (sunshine-utm/list-presets) tells the AI which presets you have, how your formatting rules change tags, and which shorteners are set up, so it uses the spellings you already use.

The AI goes through the same rules as everyone else. Formatting rules clean up its tags, and if team lists are set to Only allow these, it can’t make a link with a source or medium that isn’t on your list.

Connect Claude or another AI tool

AI tools like Claude connect to WordPress abilities through the MCP Adapter plugin, which lets them find and run abilities on your site.

  1. Install and activate the MCP Adapter plugin, following the steps in its readme.
  2. Make an Application Password for an administrator: go to Users > Profile, scroll to Application Passwords, give it a name like “Claude”, and click Add New Application Password.
  3. Add your site to your AI tool using the MCP Adapter’s instructions, with that username and Application Password.
  4. Ask for a link, like “Make a tagged link to /spring-sale/ for my newsletter using the Monthly newsletter preset, with a short link.”

The abilities only run for administrators, so the Application Password needs to belong to one. You can revoke it from your profile at any time.

Run them from a script

Each ability can also be run over the WordPress REST API, logged in as an administrator (an Application Password works well here too):

POST /wp-json/wp-abilities/v1/abilities/sunshine-utm/build-link/run
{
  "input": {
    "url": "https://example.com/spring-sale/",
    "preset": "Monthly newsletter",
    "campaign": "spring_sale",
    "shorten": true
  }
}

A preset can be given by its name or its ID, and any tag you also send replaces the preset’s value. The response has the full tagged link, the short link if you asked for one, and each tag as it ended up after formatting.

For a plain endpoint without the Abilities API, see the REST API.

Can’t find the answer to your issue? Submit a ticket