Custom Variable #4 being replaced with Search Category


#1

I couldn’t find any documentation to support or help troubleshoot this behavior, or even acknowledge it, but as I say in the title I am seeing my fourth Custom Variable being replaced by a provided Search Category. Here is the code snippet:


_paq.push(['setCustomVariable', '1', 'name1', 'value1', 'page']);
_paq.push(['setCustomVariable', '2', 'name2', 'value2', 'page']);
_paq.push(['setCustomVariable', '3', 'name3', 'value3', 'page']);
_paq.push(['setCustomVariable', '4', 'name4', 'value4', 'page']);
_paq.push(['setCustomVariable', '5', 'name5', 'value5', 'page']);
			
_paq.push(['trackSiteSearch', "Sample Search Term", "Category - Sample", false]);

The request out to piwik shows the cvars to be consistent with the custom variables I have set:


{"1":["name1","value1"],"2":["name2","value2"],"3":["name3","value3"],"4":["name4","value4"],"5":["name5","value5"]}

Yet when I look at the visitor log, the custom variables appear as follows (formatted for visibility)


Custom Variables 
- name1 = value1
- name2 = value2
- name3 = value3
- Search Category  = Category - Sample
- name5 = value5

Is there any reason for this, or some documentation I could take a look at? I’d appreciate any help anyone could extend regarding this behavior.

Thanks,
-Ben VonDerHaar


#2

Sorry for the double post, but I forgot to mention that I am on 2.2.2. However, I also experienced the same issue on 2.0.3 from which I just upgraded today.

Thanks,
-Ben VonDerHaar


(Matthieu Aubry) #3

Hi Ben, yes you have hit a limitation of Piwik where the Site Search request uses the custom variables slot 4 to store the category.
To work around this issue you may increase number of custom variable slots: How do I add more than the default 5 custom variables?
and then use the new slots from 5 to 10 which will always be free


#4

Hi Matt,

Thanks for the response. When you say the slots from 5 to 10 will always be free, do you mean that the Site Search request always uses slot 4 to store the category (and presumably slot 5 to store the number of search results), as opposed to the 2nd to last slot regardless of the number of configured custom variables?

Also, is there any sort of documentation regarding other places where this behavior occurs? I would just like a reference going forward in case I run into this somewhere else.

Thanks,
-Ben VonDerHaar


(Matthieu Aubry) #5

There is similar thing happening with ecommerce requests, but it’s not documented yet… Probably I should document that!

do you mean that the Site Search request always uses slot 4 to store the category (and presumably slot 5 to store the number of search results)

Yes