Learn business growth with Google Analytics 4 Forums Google Analytics 4 The Impact of Sending Varied Events with the Same Name to Google Analytics 4 via Google Tag Manager

  • The Impact of Sending Varied Events with the Same Name to Google Analytics 4 via Google Tag Manager

    Posted by Liam on 2 February 2023 at 10:28 pm

    Imagine channel surfing on a site with a ton of buttons, divvied up into three groups, let’s call them A, B, and C. Every one of these buttons pushes a custom button_click event to the dataLayer, when clicked. The event data includes standard columns like button, size, and so on. But there’s also a handful of “wildcard” properties that differ from set to set. Have a look:

    dataLayer.push({event: "button_click", button: "b1", size: "L", ...,       service_id:     1,  name: "John" }); // A
    dataLayer.push({event: "button_click", button: "b2", size: "S", ...,       language:  "en",  term: "Long" }); // B
    dataLayer.push({event: "button_click", button: "b3", size: "M", ...,            color: "red",  item: "Shoe" }); // C
    

    Here’s the twist: despite their differences, all three events share the same button_click name. So I’ve got two brain-busters for you:

    1. Are there any potential issues with Google Analytics4 if different events share the same name?
    2. Knowing that in reality, there’s way more than just three sets, and lots of “common columns” that need to be manually entered into Google Tag Manager (GTM) for each one, is there any way to dodge the hassle of entering them repeatedly?

    Would love to hear any thoughts or insights!

    Charlotte replied 1 year ago 3 Members · 2 Replies
  • 2 Replies
  • Olivia

    Member
    21 April 2023 at 2:05 pm

    Hey there!

    I see what you’re getting at! Firstly, dumping all button classes into DL can be a bit of a messy approach. Google Tag Manager (GTM) can gather all the info from a clicked HTML element without the data layer (DL). Usually, the front-end needs to do some sorting (like bucketing buttons into groups). This way, your analytics team won’t have to constantly check for updates or changes to the CSS.

    By the time your DL events get to Google Analytics 4 (GA4), they should ideally go through GTM. Cutting GTM out and directly using gtag.js isn’t the best practice. One tip is that GA4 shouldn’t see any of those classes in its data because the stakeholders shouldn’t have to translate CSS classes into business insights. Plus, GA4 has a cap on the number of custom dimensions it can use per event.

    But to answer your question, you can have some variety in fields for the same event as long as GTM can host the code to parse them all. Regardless of what you push to DL, GTM will reconfigure it to a network request. From there, it’s sent to GA4, which will ignore all event properties that aren’t registered into custom dimensions through its UI.

    As for potential ways for avoiding repeated entries, here’s how you can tie your events together:
    1. Create dataLayer variables for each field (excluding the event). Check out this example: [link to image](https://i.stack.imgur.com/28yP4.png)
    2. Write code that parses these variables and returns what you need. You can group them in any way you like ([example image](https://i.stack.imgur.com/7rHLG.png)).
    3. Lastly, use your Custom JavaScript (CJS) in an event field in your GA4 tag ([example image](https://i.stack.imgur.com/l072B.png)).

    Just a tip: make sure you only have this tag triggered on button_click Data Layer Event trigger. Otherwise, there might be a hiccup or two. Hope that helps a bit!

  • Charlotte

    Member
    28 May 2023 at 12:40 am

    Sure, let me simplify those for you!

    1. Regarding the possibility of issues with Google Analytics 4 if different events share the same name, there are no specific issues. The key is how you plan to analyze the data. Google Analytics 4 will group these events together since they have the same name, which could be useful if you wish to see all your button clicks in one place. However, if you need to separate data based on different buttons or properties, it might be more difficult.

    2. In reality, with a lot more groups and “common columns” to manually enter into Google Tag Manager, it can become a burdensome task. Fortunately, Google Tag Manager provides foldering and other organizational tools that could help make the task of managing numerous tags a little less tedious. Another suggestion is to use templates and variable references to avoid rewriting common constants. Alternatively, you might consider using more advanced methods, like creating scripts to automate the work, if it’s an option.

Log in to reply.