@Bogun opened this Issue on September 29th 2014

Hi all.
Could you please assist with the issue below.
We have some troubles with displaying visitors statistic in PIWIK.
When we in the filter choose "All Visits" we will see:
Custom Variable Name "Action" -> Custom Variable Value "Search".
image_1
But if we apply filter:
image_2
Custom Variable Value "Search" is not displaying:
image_3

Could you please help me with this issue?
What should i do to fix it?

Thank you in advance.

@EduardTrayan commented on September 30th 2014

Please assist, because it's a critical blocker for our team

@mattab commented on September 30th 2014 Owner

Maybe simply for urls containing videoportal then none of the pageviews had a custom variable set to Name=Action, Value=search ?

@EduardTrayan commented on September 30th 2014

I don't think so, but we insert 2 blocks of PIWIK tracking code on one page (search results page) for purposes of tracking search as action and view search results as another action.
Our code looks like this:

<script type="text/javascript">
        var _paq = _paq || [],
             date = new Date();

        _paq.push(['setCustomVariable', 1, 'Internal ip', '###', 'page']);
        _paq.push(['setCustomVariable', 2, 'User\'s login', 'Eduard Trayan', 'page']);
        _paq.push(['setCustomVariable', 3, 'Time of view', $.format.date(date, "MM/dd/yyyy HH:mm:ss") +' (UTC' + date.getOffsetString() + ')', 'page']);
        _paq.push(['setCustomVariable', 4, 'Office', '###', 'page']);
        _paq.push(['setCustomVariable', 5, 'Content type', 'search results', 'page']);
        _paq.push(['setCustomVariable', 6, 'Action', 'search', 'page']);
        _paq.push(['setCustomVariable', 12, 'Search criteria', 'test', 'page']);
        _paq.push(['setCustomVariable', 13, 'Search results count', '15', 'page']);

        _paq.push(['trackPageView']);
        _paq.push(['enableLinkTracking']);

        if (!window.isStatisticsLoads) {
            (function(global) {
                var u=(("https:" == document.location.protocol) ? "https" : "http") + "://###/";
                _paq.push(['setTrackerUrl', u+'piwik.php']);
                _paq.push(['setSiteId', 8]);
                var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
                g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
                global.isStatisticsLoads = true;
            })(window);
        }
</script>
<!-- End Piwik Code -->

<!-- Piwik -->
<script type="text/javascript">
        var _paq = _paq || [],
            date = new Date();

        _paq.push(['setCustomVariable', 1, 'Internal ip', '###', 'page']);
        _paq.push(['setCustomVariable', 2, 'User\'s login', 'Eduard Trayan', 'page']);
        _paq.push(['setCustomVariable', 3, 'Time of view', $.format.date(date, "MM/dd/yyyy HH:mm:ss") +' (UTC' + date.getOffsetString() + ')', 'page']);
        _paq.push(['setCustomVariable', 4, 'Office', '###', 'page']);
        _paq.push(['setCustomVariable', 5, 'Content type', 'search results', 'page']);
        _paq.push(['setCustomVariable', 6, 'Action', 'view', 'page']);
        _paq.push(['setCustomVariable', 12, 'Search criteria', 'test', 'page']);
        _paq.push(['setCustomVariable', 13, 'Search results count', '15', 'page']);

        _paq.push(['trackPageView']);
        _paq.push(['enableLinkTracking']);

        if (!window.isStatisticsLoads) {
            (function(global) {
                var u=(("https:" == document.location.protocol) ? "https" : "http") + "://###/";
                _paq.push(['setTrackerUrl', u+'piwik.php']);
                _paq.push(['setSiteId', 8]);
                var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
                g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
                global.isStatisticsLoads = true;
            })(window);
        }
</script>

After page loads we can see 2 requests to PIWIK instance:

https://###/piwik.php?action_name=###&idsite=8&rec=1&r=006266&h=15&m=10&s=32&url=https://videoportalqa/search/results?q=test&_stateless_search_token=4d406d92-27b9-4195-b0d9-b16a6b0db40c&urlref=https://videoportalqa/search/results?q=test&_stateless_search_token=a199dfb4-23bb-4839-9081-73db4daac434&_id=9cb16a1aeef3ea3e&_idts=1411390092&_idvc=9&_idn=0&_refts=0&_viewts=1411977688&pdf=1&qt=0&realp=0&wma=1&dir=0&fla=1&java=1&gears=0&ag=1&cookie=1&res=1920x1080&cvar={"1":["Internal ip","###"],"2":["User's login","Eduard Trayan"],"3":["Time of view","09/30/2014 15:10:32 (UTC +03:00)"],"4":["Office","###"],"5":["Content type","search results"],"6":["Action","view"],"12":["Search criteria","test"],"13":["Search results count","15"]}&gt_ms=1000

https://###/piwik.php?action_name=###&idsite=8&rec=1&r=096369&h=15&m=10&s=32&url=https://videoportalqa/search/results?q=test&_stateless_search_token=4d406d92-27b9-4195-b0d9-b16a6b0db40c&urlref=https://videoportalqa/search/results?q=test&_stateless_search_token=a199dfb4-23bb-4839-9081-73db4daac434&_id=9cb16a1aeef3ea3e&_idts=1411390092&_idvc=9&_idn=0&_refts=0&_viewts=1411977688&pdf=1&qt=0&realp=0&wma=1&dir=0&fla=1&java=1&gears=0&ag=1&cookie=1&res=1920x1080&cvar={"1":["Internal ip","###"],"2":["User's login","Eduard Trayan"],"3":["Time of view","09/30/2014 15:10:32 (UTC +03:00)"],"4":["Office","###"],"5":["Content type","search results"],"6":["Action","search"],"12":["Search criteria","test"],"13":["Search results count","15"]}&gt_ms=1000

Everything looks good.
Could you assist please?

@mattab commented on October 2nd 2014 Owner

Please look in the Visitors > Visitor Log, hover on the pageview, on the tooltip you will the custom variables names and values. It should show the proper values?

@EduardTrayan commented on October 2nd 2014

A problem was in "intelligent" behavior of PIWIK, while you search something. It parses query string and if detects search (according to internal rules) - unbinds all custom variables in this action from page uri, and we can't use filter by page url for this custom variables.

Solution: disable PIWIK search tracking in website settings "Do not track Site Search"

@mattab commented on October 2nd 2014 Owner

oh ! Sorry about that. Re-opening as it looks like a bug

@EduardTrayan commented on October 2nd 2014

I think that bug is not in name of variables.
Steps to reproduce:

  1. Register site at PIWIK admin panel with SITE SEARCH setting: Site Search tracking enabled
  2. Create route on your registered website like
http://site.com/search?q=query_string
  1. On page, which opens by link above, add some js code for registering some custom variables
  2. Open page above
  3. Go to PIWIK => Visitor => Custom variables
  4. See your custom variables
  5. Create custom segment, which will contain definition "Page url Contains site.som" and apply this segment

Actual result: you don't see your custom variables
Expected result: you can see your custom variables.

I think PIWIK doesn't bind source url with custom variables in case of search performing

@mattab commented on October 6th 2014 Owner

@EduardTrayan Right that's correct. See also: Add "Download file URL" and "Outlink URL" segments #4103

@EduardTrayan commented on October 7th 2014

Our solution is disable SITE SEARCH setting at website settings at admin panel.

How do you think, this is a bug, or feature?

@mattab commented on October 7th 2014 Owner

@EduardTrayan sorry I got confused there. Now I read again your comment:

unbinds all custom variables in this action from page uri, and we can't use filter by page url for this custom variables.

Can you please check in the log_link_visit_action table for the row of this site search request, whether the custom variables are there in the database? You can also check in Visitors>Visitorlog on hover onthe Site Search request, the tooltip should list the custom variables. are they all there?

@EduardTrayan commented on October 7th 2014

@mattab If a enable Site Search tracking
tracking

In Visitors > Visitorlog ,without custom segment about page url, I see all my custom variables
custom

But you can see that this action doesn't contain url address which it came from

And if I create&apply custom segment with expression "Page url contains ..." I can't see custom variables from action from screen

If I disable site search tracking everything works as expected

@mattab commented on October 7th 2014 Owner

And if I create&apply custom segment with expression "Page url contains ..." I can't see custom variables from action from screen

Do all custom vars still show in the tooltip in the Visitor Log when you segment?

@EduardTrayan commented on October 7th 2014

Yes, they still show, but on page "Visitors > Custom variables" with page url custom segment we can't see this variables.

Also on page "Visaitors > Visitors Log" without custom segment I see following actions

c1
c2
c3

But with custom segment I see only
c1

@EduardTrayan commented on October 15th 2014

@mattab Could you please provide information about current status of our issue?

@mattab commented on October 17th 2014 Owner

Not scheduled yet, but we hope to fix it in the next few months. If you need it faster please sponsor the work by contacting us at http://piwik.org/consulting/

@tsteur commented on February 4th 2015 Owner

Re-opening as it is indeed a bug, that Site Search requests are using Custom Variables slots that may be reserved. In this case we should throw an exception in the browser console or something?

Are we actually using Custom Variables there for this? We should rather fix this hack.

@mattab commented on February 9th 2015 Owner

Are we actually using Custom Variables there for this? We should rather fix this hack.

Actually not I was wrong... see https://github.com/piwik/piwik/blob/master/js/piwik.js#L3647-L3656

@mattab commented on February 9th 2015 Owner

Hi @EduardTrayan this issue is getting too long and I'm lost. Maybe the issue is caused becasue you use two tracking codes? Or can you reproduce the issue with only one tracking code? if so please note the steps to reproduce and we'll take a look

@AlexanderGirgis commented on March 1st 2015

Hi @mattab

I was trying to get a site search with local variables too, when I found this issue. After a brief look at the code I think the problem might be that CustomVariables are missing from the call https://github.com/piwik/piwik/blob/master/js/piwik.js#L5026-L5030 of the funcion you mentioned, however I can't set up a full stack to test it at the moment. However this feature is key to my project, I hope that helps solving the problem.

@mattab commented on March 1st 2015 Owner

Here is what we need to solve the problem / bug:

  • a clear list of steps to reproduce the issue (maybe a HTML file or two, with minimal content and the piwik code to reproduce)
  • a description of what you get VS what you expected to get

If we can reproduce the issue then we will for sure aim to fix it quickly!

@mattab commented on April 7th 2015 Owner

Please createa new bug report with steps to reproduce, and for sure we will take a look at it - thanks for your understanding

This Issue was closed on April 7th 2015
Powered by GitHub Issue Mirror