Problem with links with `utm` campaings

Any update to this feature? WpSource: Define a map of `allowedQueries` to only preserve them in data references (links)

I had to implement what I feel is a hack in the beforeSSR actions (see code below) to not allow the utm param to be passed to the wp api, as it was giving me a 404 return:

// Removing param from router link so that its not passed to the WP json api
var find = state.router.link.indexOf("utm");
if (find > 0) {
  state.router.link = state.router.link.split('?')[0];
 }

Links with utm campaings work fine in Frontity (https://mars.frontity.org/?utm=test) so I’m not sure what may be going on.

Could you reproduce the issue in a CodeSanbox (https://githubbox.com/frontity/frontity-codesandbox) so we can take a look? Thanks!

My work around for this was just:

state.router.link = state.frontity.initialLink = state.router.link.split('?')[0];

That way it wasn’t trying to redirect

I’m sorry @ryanaker but I still don’t see where is the problem. I’ve never heard of 404 problems because of utm campaigns before.

What version of the Frontity core/packages are you using? Is it the latest?

@luisherranz so with this Google UTM url:

https://stellacenter.com/symptoms-checker/?utm_source=google&utm_medium=cpc&utm_campaign=national-sgb-bmm&utm_content={{adgroupname}}&utm_term={%2Bstellate%20%2Bganglion%20%2Bblock}&adgroupid={114318186434}&campaign_id={11357676474}&adid={474440694640}&gclid=Cj0KCQiA0MD_BRCTARIsADXoopZPQ1IOYQJr7SOUHZL5vgOT81W9Q-oKYbwzQq85e4agtU6NxBq5llQaAiVpEALw_wcB

You’ll see in browser address bar that it will update the (removing params) and for whatever reason Frontity tries to find that page/route.

Our site is only custom pages as of right now, so its not using the full effects of frontity.

I’d be happen to have you look at our repo, I also have another issue needing help with:

Let’s see if I understand this correctly. For example:

  • For this initial link: https://stellacenter.com/symptoms-checker/?utm_content={{adgroupname}}
  • It is escaping it to this: https://stellacenter.com/symptom-checker/?utm_content=%7B%7Badgroupname%7D%7D

Is that correct? If so, where is the problem? Don’t Google Analytics unescape it correctly or is there any other issue?

Actually, there does seem to be an issue (I found this thread because I was also having issues with UTM tags).

Specifically, anytime there is more than 2 URL parameters being sent to custom handlers/post types, a call stack exceeded error is thrown.

You can view this on the Mars theme: Test Frontity Blog.

1 Like

That seems like a bug. I can’t reproduce it locally, but I’ll investigate.

It seems like mars.frontity.org is a bit outdated. It works in the latest version: Test Frontity Blog

I will take a look at the GH action that should be automatically deploying the latest version to mars.frontity.org.

EDIT: Wait a sec, it doesn’t seem to work.

Ok, I found the bug. It seems like Vercel started sorting the queries in their cache, so now if you visit /?b=b&a=a&c=c it will cache the result and it will use that HTML file for other URLs, like /?a=a&b=b&c=c. This is confusing Frontity because the URLs are not the same, and we do our own query sorting, which gets mixed up.

Anyway, I’ll see how it can be fixed :slightly_smiling_face:

1 Like

I’ve opened a PR with a failing e2e test: Infinite loop when client/server URL queries are sorted in the server by luisherranz · Pull Request #850 · frontity/frontity · GitHub

1 Like

The PR has been merged and we just made a new release.

Please update @frontity/core and @frontity/tiny-router to the latest version: Keep Frontity Updated - Frontity Docs

2 Likes

@ryanaker could you please confirm that the new version fixes your problem? Thanks! :slightly_smiling_face:

1 Like

Hi @luisherranz, this fixed the issue I had with Vercel, I had made a thread about it about 3 days ago!

Legend, thanks!

1 Like

I am glad to know it’s solved :slightly_smiling_face: