We currently have configured Google Analytics 4 with custom dimensions. We want to get that custom dimension out of GA4 using the CDATA Google Analytics provider with Google Analytics 4 selected. We get data out of the correct property, so everything seems to be connected right. But these are all standards reports so it seems, I want to get custom data out of it.
What should I do or what query can I use to get 1 custom dimension (customer_number), with 1 metric (event count) filtered by page_path contains 'example’ and another custom dimension (asm_user) <> 'null’?
@fab-sven Thank you for reaching out. Custom dimensions and metrics can be queried by specifying them in a WHERE clause with the Dimensions or Metrics columns. For example, the below query can be used to retrieve a custom dimension in the Engagement view, and other filters can be added as needed.
SELECT Dimensions, Metrics, Date FROM Engagement WHERE dimensions = ‘customEvent:customer_number’ AND metrics = ‘EventCount’
If you expect to use a certain combination of dimensions and metrics often, you can create a custom schema with the driver to generate a new view that contains these dimensions and metrics, which can be queried like any other view with the driver. Please see the link below for more information on this process.
I want the values customer_number itself, not only in the whete clause, but also in the select. Is that possible?
Hey @fab-sven
Have you tried looking at the CreateCustomSchema Stored procedure? The stored procedure should allow you to set your custom dimension and metric and create a view out of it. Subsequently, querying this newly created view should give you the results you are looking for.
To run a stored procedure, you can follow the syntax here: CData JDBC Driver for Google Analytics - EXECUTE Statements and specify the right input parameters to create your own custom schema for GA4 queries.
Can you give this a try and see if it helps?