UTM parameters are not passed for blog articles links

Hi! I’m trying to set up UTM parameters passing for our website.

I got this script from the Webflow support team:

It works, but not for the blog articles. I also tried to insert it into the Blog article template custom code section, but it didn’t help.

What I’m doing wrong? what could be the reason?

I’m inserting this script in the Footer customer code section

Hi Stasia, this is a very simplistic solution. I think it would likely break pagination, and the user accounts login redirect mechanism. Possible aspects of e-com as well, make sure to test all of your functionality carefully.

However if you’re trying to do URL parameter passing site-wide you’d need this in your site-wide custom code. I’d put it in the before-body custom code section in your site dashboard custom code tab, and remove it from any page-specific custom code areas you have it on.

Side note, for UTM params and affiliate tracking links, I’d usually receive them, hide them from the URL, save the content in webStorage, then access it for form submissions and API requests. That’s somewhat more complex, and you have to carefully check any cookie-consent setups, but it’s much prettier.

Thank you for the reply. That’s exactly what I did, UTM parameters were passing on all pages except to links connected inside blog articles. That’s why I tried to add the code to the blog article template, but it also didn’t work.

Ah that makes more sense- my guess is the links in your blog articles begin with https://, and Webflow’s recommended script is looking only for local links that start with /.

If you’re trying to pass the parameters to external sites as well you’ll need to revise the script. If your CMS link to your own site contain https://yourdomain.com you should be able to correct them, or redesign your script to accommodate that.

1 Like

Thank you so much! I fixed the code (with ChatGPT) according to your recommendations and now it’s working.