-
Google Analytics 4 – Using Custom Dimensions
So I’ve made a few custom dimensions for my property like this:
Name of Dimension
Scope
Property/Parameterevent_category
Event
event_categoryevent_label
Event
event_labelWhen I’m checking my website in the analytics debugger, these parameters are showing up in the events for my GA4 tag:
form_submission - Google Analytics Hit Page Location dl https://16v8x.elite80-001.ihousedev.com/contact Page Referrer dr https://tagassistant.google.com/ Event Name en form_submission System Property _ee 1 Event Parameter ep.event_category lead Event Parameter ep.event_label Contact Us API Call: gtag("event", "form_submission", {event_category: "lead", event_label: "Contact Us"}) Data Layer: { event: "form_submission", gtm: {uniqueEventId: 9, start: 1684510761995, priorityId: undefined}, eventModel: { event_category: "lead", event_label: "Contact Us", send_to: "MY TAG" } }
I thought adding these custom dimensions would let them show up in my reports, but it doesn’t look that way.
$dimensions = [ new Dimension( ['name' => 'eventName'] ), new Dimension( ['name' => 'customEvent:event_category' ]), new Dimension( ['name' => 'customEvent:event_label' ]), ]; $metrics = [ new Metric( ['name' => 'totalUsers'] ), ]; $date_range = new DateRange( [ 'start_date' => '2023-04-28', 'end_date' => date('Y-m-d') ] ); $report_params = [ 'property' => "properties/MY PROPERTY ID", 'dateRanges' => [ $date_range ], 'dimensions' => $dimensions, 'metrics' => $metrics, ]; $response = $client->runReport( $report_params );
If I leave out the two new custom dimensions, I see most of the events I’m expecting. But, if I add in either or both, nothing shows up. Did I screw up the specs for the custom dimensions? Or do I need to wait for events I triggered after making the new dimensions? I thought the values for category and label would be in the existing events, but maybe not. The long delay between doing stuff on my website and the events showing up in GA4 is seriously putting a dent in my testing.
Log in to reply.