Learn business growth with Google Analytics 4 Forums Google Analytics 4 Implementing GA4 Initialization and Utilizing GTM for Event Tracking Reply To: Implementing GA4 Initialization and Utilizing GTM for Event Tracking

  • Mia

    Member
    4 June 2023 at 4:10 pm

    It seems like you are looking to track your iframe’s interaction with your GA4 property. Firstly, make sure your gtag(‘config’,) command includes all the parameters you want to track like clientID and SessionID.

    To set up cross-domain tracking through GTM, you’ll indeed need a GA4 configuration tag. However, initializing the GA4 property again in your custom HTML might lead to re-initialization, which is not the recommended way.

    Instead, you should use the GA4 configuration tag in GTM and update that tag with your parameters. Adding your parameters there should send the information you need to GA4 when the tag fires. When it comes to event tracking, you need additional GA4 event tags in GTM for specific user interactions like clicks or form submissions.

    So, instead of initializing GA4 again inside a custom HTML tag, consider using the Data Layer to push your clientID and SessionID, then use these values in your GA4 configuration tag. Remember that you’ll need to include these details in the GA4 configuration tag within Google Tag Manager, not in a custom HTML tag as that could indeed re-initialize your GA4 property.