

Carter
Forum Replies Created
-
Carter
Member6 July 2023 at 4:48 pm in reply to: How to track custom event occurrences with specific parameters in GA4 using the API?Your approach is accurate, but you’ve encountered a problem because stringFilter cannot be used with metricFilter. Instead, you should continue to use dimensionFilter. When setting up the event, consider the “userId” as a parameter to your “butt” event, which means it considers to be a part of dimension, not metric.
Here’s how you should filter events where the “userId” parameter matches a certain value:
`javascript
const [response] = await analyticsDataClient.runReport({
property: ‘properties/’+process.env.GA4ID,
dateRanges: [{
startDate: ‘2020-03-31’,
endDate: ‘today’,
}],
dimensions: [
{name: ‘eventName’},
{name: ‘customEvent:userId’}
],
dimensionFilter: {
andGroup: {
filters: [
{
filter: {
fieldName: ‘eventName’,
stringFilter: {value: ‘butt’}
}
},
{
filter: {
fieldName: ‘customEvent:userId’,
stringFilter: {value: ‘VD5894237597126308723423’}
}
},
]
}
},
metrics: [
{name: ‘eventCount’}
],
});
`
This way, you’re checking for two filters: if the event name is ‘butt’ and if the userId matches ‘VD5894237597126308723423’. Now you should get the results filtered for specific userId. -
Carter
Member4 July 2023 at 9:35 pm in reply to: Implementing GA4 Tracking for Customer Segments and ActivityYep! It’s actually pretty straightforward if you’re already sending the data to the data layer. You just need to create a data layer variable with the name ‘customerGroup’ and it will get passed to GTM, easy peasy.
Just keep in mind, if you are setting up a custom push, it needs to happen after the GTM snippet is loaded. Otherwise, there might not be a data layer to push to or it might get overwritten once GTM loads.
Also, when you’re working with the user or event where you need the data, remember to pass the variable in a parameter within the tag and then set up the custom dimension on the GA4 side. A little heads up though, the parameter might not show up in GA4 until a day later or whenever it next refreshes. So, it might be a little while before you can create it. But don’t worry, it’s all part of the process!
-
Carter
Member29 June 2023 at 2:23 am in reply to: Resolving GA4 Issue: Duplicate Page View Counts on Initial User VisitsIt sounds like you’ve got a duplicate tracking code implemented in your website. That can cause double counting. Take a look at your website source code or use a tool like Google Tag Assistant to identify any redundant Google Analytics tags. Remove the duplicates, then check if the issue resolves.
-
Carter
Member20 June 2023 at 11:16 am in reply to: Troubleshooting: Inconsistency with GA4 custom event firing outside of tagassistant preview modeThere may be several reasons causing this issue. The main reason could be that the conditions set for the trigger under GTM’s settings may not be met outside the preview mode. Please ensure that your tag and trigger is set to fire under all conditions that exist in your live environment. Another possible reason could be there’s a discrepancy between the live environment and the preview mode environment (due to ad blockers, firewall, browser settings, or even latency issues). Also, there could be a conflict or redundancy with other created tags. Make sure that priority settings or tag sequencing settings aren’t interfering with the firing of your custom tag. If none of these apply to you, I suggest to get help from GTM support team.
-
Carter
Member8 May 2023 at 11:39 pm in reply to: Google Analytics 4 API: Location dimension not appearingAs of now, the Google Analytics 4 API does not directly provide latitude and longitude data or location dimension for real-time metrics. Unfortunately, there’s no workaround to extract such data at the moment. Google has not announced any plans to include this feature before retiring Universal Analytics, so we can only wait and see if Google will make this update in future iterations of the API.
-
Carter
Member23 April 2023 at 5:30 am in reply to: How to Implement a Search-and-Replace Filter in GA4 for Google Analytics?Sure thing! Looks like you’re trying to add “/from-somehost” to the page view paths of a host. In GA4, you can’t set filters like in UA, but you can pull the hostname and path to your exploration reports and tweak them how you like.
By the way, a lot of data gurus find GA/GA4 a bit restrictive, so they go one step further. They pull the data into BigQuery (BQ), analyze the raw data there or transform the data more (that’s what ETL stands for – Extract, Transform, Load). And then, they use more powerful tools to make dashboards and do some detailed analysis. Just a thought in case you need more flexibility!