Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › Optimal placement of parameters for GTM-driven GA4 auto-tracking events › Reply To: Optimal placement of parameters for GTM-driven GA4 auto-tracking events
-
Alright, let’s crack this.
So, in your case, you got two options. First, you can use Google’s built-in listener for GA4 analytics. This will automatically capture and send events like a ‘video_start’ to GA4 right when they happen (neat, huh?). But one downside with auto-mode is that you can’t customize the events or add any specific details.
Second option, and where we’re heading now, is you doing your own magic (like a true wizard!). So, yes, your own events and parameters can be sent to GA4 via GTM. This is where Data Layer plays a super useful role – as kind of a handyman, keeping all your request data in one place for GTM to use.
Just push info right onto the Data Layer like this thinking: “Hey Data Layer, hold this for me”:
`javascript
dataLayer.push({
event:’video_start’,
video_params:{
title:’my title’,
url:’my-url’
}
});
`
Next, hop onto GTM and create some Data Layer Variables for your data to stop by before it heads to GA4:
[Data Layer Variable Image](https://i.stack.imgur.com/V0oOA.png)
[Data Layer Variable Image](https://i.stack.imgur.com/nQA1i.png)
Now, we’re in the homestretch! Just set up your GA4 tag like this to send your data along. Be sure to match your parameters with your newly-created GTM variables.
[GA4 Tag Example](https://i.stack.imgur.com/hIQ7B.png)
And there you go, pal! Happy tracking!