I am using the following BigQuery Export data scheme https://support.google.com/analytics/answer/3437719?hl=en&ref_topic=3416089
And want to export hits data with extra 2 fields from custom dimensions (array fields) on plain SQL it would be something like this:
select visitId,visitStartTime,customDimensions.value, hits.SOME_HIT_INFO,
hits.customDimensions.value
from session_data
left join hits
left join customDimensions where customDimensions.index=100
left join hits.customDimensions where hits.customDimensions.index=200
How it will look on BigQuery query syntax ?
UPD:
for example I have the folowing data:
{
'visitId' : 1
'visitStartTime' : ...,
....
'hits' : [
{
'refferer: 'REF1'
....
'customDimensions' : [
{'index':200,'value':'HITVALUE200'},
{'index':202,'value':'HITVALUE202'},
]
}
],
'customDimensions' : [
{'index':100,'value':'VALUE100'},
{'index':102,'value':'VALUE102'},
]
}
I want to receive something like this:
+------------------------------------------------------------+ | visitId | hits.refferer | hits_cd_INDEX_201 | cd_INDEX_101 | +------------------------------------------------------------+ | 1 | REF1 | HITVALUE201 | HITVALUE101 | +------------------------------------------------------------+
```