Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › How to Use a Custom Dimension with GA4 and JDBC › Reply To: How to Use a Custom Dimension with GA4 and JDBC
-
It’s likely you’re seeing an error because the syntax of your query is incorrect. In the Google Analytics 4 (GA4) SQL system, custom dimensions are not queried in the same way as regular dimensions. The ‘Dimensions’ in your query is likely being interpreted as a column name, resulting in an error because there’s no such column present in the “GoogleAnalytics4″.”Engagement” table.
Instead of including ‘customUser:dimension1’ within the WHERE clause of the SQL statement, you should include it as one of the fields being selected, just like ‘Date’ and ‘conversions’. This is because ‘customUser:dimension1’ is a dimension, not a specific value within a column. Your query should look somewhat like this: ‘SELECT Date, conversions, customUser:dimension1 FROM “GoogleAnalytics4″.”Engagement” where Date=’20230510”. Performing the query in this manner should solve your problem, assuming ‘customUser:dimension1’ is a valid dimension within your GA4 dataset.