Google keyword match modifiers issue

(Kumar Ebalnasral) #1

Why does matomo remove broad match modifier (e.g. plus sign) from keyword and replace it with space character? Is it expected behavior or a bug?
Saving keyword modifiers is necessary for analytics purposes.
I’m using Matomo 3.6.0

(Lukas Winkler) #2


I am not sure what exactly you are talking about?

Do you mean that Matomo replaces + signs with spaces in - Web Analytics Reports - Matomo?

(Kumar Ebalnasral) #3

Hi, thanks for reply.
This screenshot of matomo_log_visit table. First five records have double spaces between words - each extra space character is replaced plus sign (broad match modifier).

  • Example keyword: +women’s +hats
  • Example search: hats for women

Second five records don’t have any extra spaces because it’s default match type.

(Kumar Ebalnasral) #4

@Lukas I hope I’ve explained myself well in previous reply.
May I ask you if you have confirmed the bug or not?

(Kumar Ebalnasral) #5

Hi, @Lukas
The source of issue is urldecode function:


        $valueFromRequest = trim(urldecode($valueFromRequest));


        protected function detectCampaignFromString($string) {...

Menu “Acquisition -> Campaigns”, Campaign Keywords widget

        $raw = urldecode($value);

It’s intented behaviour as documentation says:

Returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent ( % ) sign followed by two hex digits and spaces encoded as plus ( + ) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type. This differs from the » RFC 3986 encoding (see rawurlencode()) in that for historical reasons, spaces are encoded as plus (+) signs.

So urldecode consider plus sign as space sign and decode it accordingly.
But in this case the result is incorrect and undesirable cause +women’s +hats and women’s hats are different search keywords.
Should I open issue with that on github?

(Lukas Winkler) #6


Thanks for looking into it. It would be great if you could open a github issue.