kalnyc67 / analytics-issues

Automatically exported from code.google.com/p/analytics-issues
0 stars 0 forks source link

Ordering by ga:daysSinceLastSession returns column compared as String #563

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Name of affected component: Core Reporting API

Issue summary:
When querying for metric ga:users, dimension ga:daysSinceLastSession; ordering 
by ga:daysSinceLastSession returns values ordered as string (1, 10, 100, 101, 
11, 2, etc.) instead of being compared as number (1, 2, 3, etc.)

Steps to reproduce issue:
1. Make a query to Core Reporting API, using ga:users as metric and 
ga:daysSinceLastSession as dimension
2. Order results by "ga:daysSinceLastSession" or "-ga:daysSinceLastSession"

Expected output:

╒═════════════════════════��
�╤═══════════════╕
│ ga:daysSinceLastSession  │   ga:users    │
╞═════════════════════════��
�╪═══════════════╡
│             0            │       X       │
├─────────────────────────��
�┼───────────────┤
│             1            │       X       │
├─────────────────────────��
�┼───────────────┤
│             2            │       X       │
├─────────────────────────��
�┼───────────────┤
│             3            │       X       │
├─────────────────────────��
�┼───────────────┤
│             4            │       X       │
├─────────────────────────��
�┼───────────────┤
 etc.

Actual results:

╒═════════════════════════��
�╤═══════════════╕
│ ga:daysSinceLastSession  │   ga:users    │
╞═════════════════════════��
�╪═══════════════╡
│            0             │       X       │
├─────────────────────────��
�┼───────────────┤
│            1             │       X       │
├─────────────────────────��
�┼───────────────┤
│            10            │       X       │
├─────────────────────────��
�┼───────────────┤
│            100           │       X       │
├─────────────────────────��
�┼───────────────┤
│            102           │       X       │
├─────────────────────────��
�┼───────────────┤
│            11            │       X       │
├─────────────────────────��
�┼───────────────┤
│            110           │       X       │
├─────────────────────────��
�┼───────────────┤
│            2             │       X       │
├─────────────────────────��
�┼───────────────┤
│            20            │       X       │
├─────────────────────────��
�┼───────────────┤
│            21            │       X       │
├─────────────────────────��
�┼───────────────┤
etc.

Notes:

This also happens without the order variable set, as probably the API is 
ordering by default using "ga:daysSinceLastSession"

Original issue reported on code.google.com by potter...@gmail.com on 8 Jan 2015 at 1:37