Learn business growth with Google Analytics 4 Forums Google Analytics 4 Enhancing Google Analytics: Modifying Events and Properties with Custom Values

  • Enhancing Google Analytics: Modifying Events and Properties with Custom Values

    Posted by Wyatt on 7 July 2022 at 8:51 pm

    I’m creating a website and I’m using Google analytics to track button clicks. I modified analytics prop5 and added data-region to the button. The button’s EVAR5 now returns a default value of ‘D=C5’, but I want to change EVAR5,6,8 and add the new events 100 and 101 for failed button clicks. However, when I adjust the data-region, only PROP5 changes and the new prop5 value shows in prop6 and prop7, which I’d rather not change. Do you have any suggestions to manage events and props? Below is the code and a screenshot of the data analytics for the code.

    Archie replied 12 months ago 3 Members · 2 Replies
  • 2 Replies
  • Kendall

    Member
    16 April 2023 at 7:42 pm

    To manage events and props, you will need to define unique identifiers for each event and prop you wish to track. Instead of directly changing PROP5, try to create new props for each tracking item. For event tracking such as failed button clicks, you can create new events (100 and 101 as per your requirement). These new events can then be linked to the relevant event handlers in your button’s code. This way, you avoid any overlap or confusion between different tracked elements on your webpage. As for the problem where modifying one prop (PROP5) causes changes in others (PROP6 and PROP7), it may be due to some form of inherited behavior in your code. Make sure to initialize and/or assign your props independently to prevent unintended changes. Remember, this is a simple explanation and exact process may vary based upon the complexity of the website. Please consult a developer or analytics specialist for accurate understanding.

  • Archie

    Member
    28 June 2023 at 4:29 am

    Setting up Google Analytics for specific event tracking like button clicks often requires careful management of properties (props) and events. In your case, you want to change certain ‘EVARs’ (Conversion Variables) and add new events without affecting others. Unfortunately, without seeing the actual code and the screenshot of the data analytics, it’s difficult to give specific advice.

    However, usually, you can prevent changes in one property from affecting others by isolating the tracking scripts or implementing condition checks in your code. You can potentially encapsulate those tracking codes specific to PROP5 within an if-else clause, checking if event related is to button click. Plus, it’s important that your prop6 and prop7 aren’t said to equal prop5 or aren’t copying the input from prop5.

    For adding new events like 100 and 101 for failed button clicks, you may want to use the ‘hitCallback’ function to fire an event when a tracked button click does not lead to the expected outcome. If done correctly, Google Analytics should then register this as a unique event.

    Remember, applying this solution differs depending on the structure of your code and the specifics of the analytics implementation on your site. These are just suggestions and starting points for solving the issue you’re facing. If you’re still having trouble adjusting the properties and events as desired, it may be useful to consult with a developer who specializes in Google Analytics integration.

Log in to reply.