Custom menu links are modified and broken by Discourse

I need to add a link to the burger menu:

https://example.com?truendo_open=cookie_settings

However the link is modified by Discourse system, which breaks the functionality:

https://example.com/latest?truendo_open=cookie_settings

The link should open a privacy setting panel provided by Truendo CMP, which is a legal requirement in the EU and some other parts of the world. The settings panel does open when pasted to the browser URL field manually.

Truendo is now live at Tappara.co, but I need to implement the link to be compliant with the GDPR legistlation and the terms of Google Adsense, which is used to finance the site.

2 Likes

Just letting you know we have a repro and will try to get this sorted in the next 4 weeks or so.

1 Like

:facepalm: I’ve been seeing this issue for a while and never thought anything of it when one of my sidebar links stopped working.

Yeah, parsing URLs may sound like a good idea, but then it can cause issues like this and rarely adds actual value.

Regarding Truendo CMP, I had to disable it as the free version does not work with Google Adsense. AdSense requires TCF, which is not a part of the free plan. For someone not using advertising, but still needing a CMP for analytics etc., it feels like a decent 3rd party solution.

@ljpp we are looking at this, but I just wanted to double check something in the meantime. If you put a link to https://example.com/latest?truendo_open=cookie_settings in a post on your forum and click it, does Truendo detect it correctly and open the preferences?

I suspect the answer is no, because navigations within Discourse are not full page reloads, and I doubt truendo listens to ‘soft navigations’ within a PWA. But I’d love to be wrong on this! :thinking:

If it doesn’t work, then I think you’d need to use some kind of Javascript API from Truendo to pop the preferences open, instead of relying on the magic link.

1 Like

That is correct and so is the rest of your post.

And this seems to apply to CMPs in general, not just Truendo, including AdSense’s own solution.

I just applied for the Advertising Plugin feedback group to report the same issue more thoroughly.

1 Like

Google’s documentation.

This commit should allow arbitrary query parameters to be included in sidebar links:

There are still a couple of quirks which are more general than the sidebar:

  1. As discussed above, if the query parameter is intended to trigger something in a third-party JS library, they will need to have support for Single Page Apps (SPAs)

  2. Ember (our JS framework) currently strips any unrecognized query parameters immediately after navigation. So, even though the sidebar link includes the query param, it may disappear as soon as you navigate.

    We are keeping an eye on potential future solutions to this in the Ember framework :eyes:

In the meantime, one workaround for both those problems would be to make the link to some external site, which then redirects back to your forum. (e.g. a URL shortening service)

4 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.