{"action":"created","issue":{"url":"https://api.github.com/repos/piwik/piwik/issues/9931","repository_url":"https://api.github.com/repos/piwik/piwik","labels_url":"https://api.github.com/repos/piwik/piwik/issues/9931/labels{/name}","comments_url":"https://api.github.com/repos/piwik/piwik/issues/9931/comments","events_url":"https://api.github.com/repos/piwik/piwik/issues/9931/events","html_url":"https://github.com/piwik/piwik/issues/9931","id":141120547,"number":9931,"title":"Custom Dimensions are Inserted into the Wrong Columns","user":{"login":"3dmashup","id":454051,"avatar_url":"https://avatars.githubusercontent.com/u/454051?v=3","gravatar_id":"","url":"https://api.github.com/users/3dmashup","html_url":"https://github.com/3dmashup","followers_url":"https://api.github.com/users/3dmashup/followers","following_url":"https://api.github.com/users/3dmashup/following{/other_user}","gists_url":"https://api.github.com/users/3dmashup/gists{/gist_id}","starred_url":"https://api.github.com/users/3dmashup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3dmashup/subscriptions","organizations_url":"https://api.github.com/users/3dmashup/orgs","repos_url":"https://api.github.com/users/3dmashup/repos","events_url":"https://api.github.com/users/3dmashup/events{/privacy}","received_events_url":"https://api.github.com/users/3dmashup/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-15T22:47:25Z","updated_at":"2016-03-29T17:26:04Z","closed_at":null,"body":"The Piwik application (vsn 2.16.1-b2) is inserting the custom dimension data into the wrong columns. To reproduce\r\nConfigure a Web site with 15  visit dimension and 15 action  dimensions.  Create a Web site with 7 visit dimensions and  7  action dimensions . Run the following  test program\r\n```html\r\n<!DOCTYPE html>\r\n<!--\r\nTo change this license header, choose License Headers in Project Properties.\r\nTo change this template file, choose Tools | Templates\r\nand open the template in the editor.\r\n-->\r\n<html>\r\n    <head>\r\n        <title>Custom DImension Test</title>\r\n        <meta charset=\"UTF-8\">\r\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n        <!-- Piwik -->\r\n            <script type=\"text/javascript\">\r\n              var _paq = _paq || [];\r\n              _paq.push([\"setDomains\", [\"*.wrap.co\"]]);\r\n              _paq.push(['trackPageView']);\r\n              _paq.push(['enableLinkTracking']);\r\n              (function() {\r\n                var u=\"//tim-piwik01.wrap.co/piwik/\";\r\n                _paq.push(['setTrackerUrl', u+'piwik.php']);\r\n                _paq.push(['setSiteId', 1898]);\r\n                var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];\r\n                g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);\r\n              })();\r\n              \r\n              function sendCustomDimensions(v1,v2,v3,v4,v5,v6,v7) {\r\n                  _paq.push(['setCustomDimension', '1', v1]);\r\n                  _paq.push(['setCustomDimension', '2', v2]);\r\n                  _paq.push(['setCustomDimension', '3', v3]);\r\n                  _paq.push(['setCustomDimension', '4', v4]);\r\n                  _paq.push(['setCustomDimension', '5', v5]);\r\n                  _paq.push(['setCustomDimension', '6', v6]);\r\n                  _paq.push(['setCustomDimension', '7', v7]);\r\n              };\r\n              \r\n            function sendEvent(category, action, label, value) {\r\n                _paq.push(['trackEvent', category, action, label, value])  \r\n            };\r\n              \r\n              function sendPageView(title) {\r\n                window._paq.push(['trackPageView', title]);\r\n                  \r\n              };\r\n            </script>\r\n            <noscript><p><img src=\"//xxxxxxx....piwik/piwik.php?idsite=1898\" style=\"border:0;\" alt=\"\" /></p></noscript>\r\n        <!-- End Piwik Code -->\r\n\r\n    </head>\r\n    <body>\r\n        <div>Custom Dimension Test</div>\r\n        \r\n        <script type=\"text/javascript\">\r\n            var d = new Date();\r\n            var n = d.toUTCString(); \r\n            var cards = [ 'card 1 ' + n , 'card 2 '+ n];\r\n            var dimensions = [ \"dim 1\", \"dim 2\", \"dim 3\", \"dim 4\", \"dim 5\", \"dim 6\", \"dim 7\"];\r\n            \r\n            for (  i = 0; i <  cards.length; i++) {\r\n                d = [];\r\n                for ( j = 0; j < dimensions.length;  j++) {\r\n                    d[j] = dimensions[j] + ' ' + n;\r\n                }\r\n                sendCustomDimensions(d[0],d[1],d[2],d[3],d[4],d[5],d[6]);\r\n                sendPageView(cards[i]);\r\n            };\r\n            \r\n        </script>\r\n    </body>\r\n</html>\r\n\r\n```\r\n\r\nThe tracking url sent is: \r\n\r\nhttps://xxxxxxxxx/piwik/piwik.php?action_name=card%202%20Tue%2C%2015%20Mar%202016%2021%3A49%3A54%20GMT&idsite=1898&rec=1&r=634934&h=14&m=49&s=55&url=http%3A%2F%2Flocalhost%3A8383%2FPiwik_Test%2FDim2.html&_id=394575a3f7d8d6d4&_idts=1458067748&_idvc=3&_idn=0&_refts=0&_viewts=1458078595&send_image=0&pdf=0&qt=0&realp=0&wma=0&dir=0&fla=0&java=1&gears=0&ag=0&cookie=1&res=3840x2160&dimension1=dim%201%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&dimension2=dim%202%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&dimension3=dim%203%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&dimension4=dim%204%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&dimension5=dim%205%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&dimension6=dim%206%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&dimension7=dim%207%20Tue,%2015%20Mar%202016%2021:49:54%20GMT&gt_ms=1\r\n\r\nThe tracking url  correctly matches the dimension and values.\r\nOn querying  the database   the log_link_visit_action_table  has the misplaced values\r\n\r\nCustom\t\tidcustomdimension  Column Value\r\nDimension\r\nColumn Name\r\n1                        1         \t\t\tdim%201%20Tue,%2015%20Mar%202016%2021:49:54%20GMT\r\n2                        3\t\t\t\tdim%203%20Tue,%2015%20Mar%202016%2021:49:54%20GMT\r\n3                        5\t\t\t\tdim%205%20Tue,%2015%20Mar%202016%2021:49:54%20GMT\r\n4                        7\t\t\t\tdim%207%20Tue,%2015%20Mar%202016%2021:49:54%20GMT\r\n5                        9\t\t\t\tnull\r\n6                      11\t\t\t\tnull\r\n7                      13\t\t\t        null\r\n\r\nThe idcustomdimension value was obtained by querying the custom_dimensions table and matching the scope and index for this web site.\r\nIt  appears that the problem is the  dimension index value is not being used to place the  data into the correct column, its more likely that the  custom dimension idcustimdimension value is being used. This occurs for both visit and action  scoped custom dimension data.\r\n"},"comment":{"url":"https://api.github.com/repos/piwik/piwik/issues/comments/203010669","html_url":"https://github.com/piwik/piwik/issues/9931#issuecomment-203010669","issue_url":"https://api.github.com/repos/piwik/piwik/issues/9931","id":203010669,"user":{"login":"3dmashup","id":454051,"avatar_url":"https://avatars.githubusercontent.com/u/454051?v=3","gravatar_id":"","url":"https://api.github.com/users/3dmashup","html_url":"https://github.com/3dmashup","followers_url":"https://api.github.com/users/3dmashup/followers","following_url":"https://api.github.com/users/3dmashup/following{/other_user}","gists_url":"https://api.github.com/users/3dmashup/gists{/gist_id}","starred_url":"https://api.github.com/users/3dmashup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3dmashup/subscriptions","organizations_url":"https://api.github.com/users/3dmashup/orgs","repos_url":"https://api.github.com/users/3dmashup/repos","events_url":"https://api.github.com/users/3dmashup/events{/privacy}","received_events_url":"https://api.github.com/users/3dmashup/received_events","type":"User","site_admin":false},"created_at":"2016-03-29T17:26:04Z","updated_at":"2016-03-29T17:26:04Z","body":"Didn't mean to close the issue.  How does idcustomdimension  map to the database columns? Surely for each dimension the index  column value should determine how the value maps to each column custom_dimension_1,  custom_dimension_2,  ....  ?\r\n<img width=\"1329\" alt=\"screenshot 2016-03-29 10 22 15\" src=\"https://cloud.githubusercontent.com/assets/454051/14117235/9fc3d448-f598-11e5-85ec-7dec00c590ab.png\">\r\n"}}