@AndrewIsh opened this Issue on March 8th 2016

I am having trouble setting the "Keep Page URL fragments when tracking Page URLs" option for a website. The site is tracking fine. The select box for the "Keep Page URL fragments when tracking Page URLs" option has no value selected. When I select "Yes", then click "Save", it appears to save OK. But when I go back to the config menu for that website, the option is once again unselected.

Any ideas anyone?

@sgiehl commented on March 8th 2016 Member

The value seems to be saved in the database correctly. But the saved value isn't preselected. Seems to be a bug.

@tsteur commented on March 15th 2016 Owner

I tried to reproduce but couldn't. Maybe I don't understand this part correctly:

But when I go back to the config menu for that website, the option is once again unselected.

Whatever value I select and save for a website, when I open the website again, it's always correctly preselected. Tested with latest Chrome and latest Piwik 2.16

@sgiehl commented on March 16th 2016 Member

I'm able to reproduce that on my local instance. When editing any website most of the select values are not correctly preselected. Only selection of currency and time zone is correct.

Chrome dev tools are showing this generated html for the fragment selection:

<select ng-options="key as value for (key, value) in keepURLFragmentsOptions" ng-model="site.keep_url_fragment" class="ng-pristine ng-valid">
  <option value="?" selected="selected" label=""></option>
  <option value="0" label="No (Default)">No (Default)</option>
  <option value="1" label="Yes">Yes</option>
  <option value="2" label="No">No</option>
@tsteur commented on March 17th 2016 Owner

Which browser are you using? I can prepare a patch to see if it changes something... maybe you can test it afterwards. I'll comment in a bit

@tsteur commented on March 17th 2016 Owner

Can you try the following change?

I couldn't test it since I'm on a branch and cannot switch easily but it should work:


@sgiehl commented on March 17th 2016 Member

latest Chrome on Windows 7 but doesn't work on Firefox, aswell.
Tried your proposed change, but it didn't help

@sgiehl commented on March 21st 2016 Member

@tsteur I've adjusted the branch a bit. Using integers as keys solves the problem for me. Would you check if it still works and merge it to master if so.

@tsteur commented on March 28th 2016 Owner

I think that would break it on other systems. It seems to depend whether you get from database or rather from API an integer or a string. In my case I'm getting "ecommerce":"0". We'd basically have to convert all ng-models to integer or to string and also use the same for options. I might be able to work on this later.

@tsteur commented on March 28th 2016 Owner

@sgiehl I pushed https://github.com/piwik/piwik/commit/95e23b789543905ebc01e803dbb9a0a99b212508 and now it should always work as it will always use integers. Before you pull you can likely try to create a new site and see it wouldn't pre-select anything because it expected strings. Now it should always work with integers and work in all cases.

@mattab commented on March 29th 2016 Owner

FYI, AFAIK it's possible this inconsistency (int VS string) comes from the MySQL adapter used (PDO vs Mysqli).

This Issue was closed on March 29th 2016
Powered by GitHub Issue Mirror