There are at least two places to add the user_id
parameter in the Google Tag settings in Google Tag Manager - "Configuration settings" and "Shared event settings". There is a blog post demonstrating that the correct place is the "Configuration parameter" area, however GTM only provides you with a checkmark and "This is a recognised parameter" when adding it to the "Shared event settings".
In debug mode, the user_id
seemed to be sent with all events regardless of where I put it.
Where is the correct place to define the user_id
?
The configuration parameter is the appropriate place to include the user_id dimension, which is a user-level dimension. This is because the user_id is a user attribute that should be sent with all events after the user_id is assigned to a user. If you want to send the user_id dimension only with specific events, you can set this parameter at the event level in your desired GA4 events tags.