Learn business growth with Google Analytics 4 Forums Google Analytics 4 Troubleshooting Issue with Classname Trigger for Element

  • Troubleshooting Issue with Classname Trigger for Element

    Posted by Morgan on 30 November 2022 at 9:20 pm

    Hey there, I’m a newbie to GA4 and have managed to get tags fired up on class elements, but I’m puzzled as to why this particular one isn’t firing. I’ve played around with “strip-section” so I’m sure it’s not just a typo error or anything like that. I’m stumped. Here take a look:

    click for a better look

    here's another one

    This tag is supposed to fire on a class click. Any tips? I’d really appreciate it.

    Samuel replied 1 year, 4 months ago 3 Members · 2 Replies
  • 2 Replies
  • Connor

    Member
    27 March 2023 at 1:20 am

    Sure, let’s break this down:

    1. First off, the ‘Click Element’ needs to be in a more specific format known as the ‘match css selector’. So even though using ‘contains’ might seem alright, for Google Tag Manager it’s best to utilize the ‘match css selector’.

    2. Secondly, we need to capture the full name of the class, not partials. In your case, it should look like this: ‘div.stips-section.stips-money-tips’.

    If we follow these steps, your tag should start firing as expected.

  • Samuel

    Member
    15 May 2023 at 1:00 pm

    From your shared code, it’s hard to pinpoint the issue without additional details. However, common issues can be related to spelling/case-sensitivity in the class name or the structure of the HTML. You can use the Google Tag Manager’s preview mode feature for troubleshooting—this will help to ensure that clicks on the target element are properly recognized, and that the class of the clicked element matches exactly with what you’ve provided in the Google Analytics tag setup.

Log in to reply.