Forum Replies Created

  • Jacob

    Member
    5 July 2023 at 1:04 pm in reply to: Google Analytics 4 – Events Not Showing

    Sure, I can assist you with that. For “phone_capture” event, you may have to create a custom dimension in GA4 to capture it. In GA4, ‘event_category’ and ‘event_label’ have to be explicitly set as event parameters, which might be why you are having trouble seeing these. It may require some parameter remapping or creating custom definitions. Ensure these have been set up properly.

  • You seem to be trying to track unique users but are stuck finding the right metrics. Unfortunately, Google Analytics API doesn’t directly provide user ID data due to privacy issues. However, you can utilize metrics like ‘ga:users’ or dimensions like ‘ga:clientId’, but remember they won’t precisely identify individual users, and some legwork might be needed.

  • It looks like you may need to add a conditional check to ensure that the transaction_id has a value before pushing the purchase event into the dataLayer. Using Shopify’s Liquid language, you can implement a simple check around the dataLayer.push() function that checks whether the transaction_id (or order.order_number in your code) has been set. You’d do this by wrapping the purchase event inside an if statement that checks if order.order_number is not empty. If the order.order_number is not available, the purchase event won’t be pushed to the data layer. If there are other places in the code where you’re pushing data to dataLayer, you’d also need to implement similar conditional checks. As always, after making these changes, remember to test thoroughly to make sure it works as expected and does not interfere with other functions or tracking features.

  • Jacob

    Member
    13 May 2023 at 1:05 am in reply to: Trouble Obtaining Revenue Data Despite Proper GA4 and GTM Set-up

    It sounds like you’ve got a bug somewhere. You’ve followed all setup rules for GA4 so maybe it’s worth checking over your event configurations and triggers again. You should also make sure your transactions are marked as ‘conversions’, otherwise GA4 may not be showing your conversion revenue.

  • Alright, let’s break this down into three steps:

    1. Start by creating a ‘Custom JavaScript Variable’
    Here’s a screenshot of how to do it
    enter image description here
    Then, use this code:

    `
    function(){
    // Getting the clicked element
    var clickElement = {{Click Element}};

    // Making sure we have the parent element we want. If not, we return ‘false’
    if(!clickElement.closest(“div.stepped-selection__list-item”))
    return false;

    // Checking if the parent dom has the attribute we want.
    // Returns the attribute value if it’s there, ‘false’ if it’s not.
    var modelListDom = clickElement.closest(“div.stepped-selection__list-item”);
    if(modelListDom.hasAttribute(“data-trackervalue”)){
    return modelListDom.getAttribute(“data-trackervalue”);
    }
    return false;
    }
    `

    2. Now, let’s create the trigger
    Here’s another screenshot for you:
    enter image description here
    Start with the ‘click element’ > ‘match css selector’ to nab all the elements inside the selector. You can tweak this a bit to suit your case. Then, use the ‘Variable’ we created in step1. If this gives back ‘false’, we don’t want to trigger the tag.

    3. Next up, Create the Tag
    Doing the ‘Tag’ config is the easy bit. Just take the ‘Trigger’ from step2, name the event and event parameter to your liking. Finally, set the event parameter value as the ‘Variable’ from Step1.

  • Jacob

    Member
    3 April 2023 at 9:08 am in reply to: Understanding Duplicate Path Tracking in Google Analytics (4)

    The duplication you’re seeing is likely a result of how page paths are being captured in GA4. When your data gets sent to GA4, the ‘page_location’ parameter effectively becomes the full URL, including the scheme (HTTP/HTTPS), the domain, and the page path. However, the ‘page_path’ parameter should ideally only include the URI. If your tracking snippet is not configured correctly, it might cause the full URL to be captured for both ‘page_location’ and ‘page_path’, leading to duplicate entries.

    Additionally, another cause could be separate tags firing for the same page view – one capturing the domain and the other not. This could be due to multiple instances of GA4 installed on your website either manually or through Google Tag Manager.

    To solve this, you need to review your event tagging setup for page views to ensure it’s only capturing the desired information and not duplicating tags. For assistance with this, you may wish to bring a web developer or a digital analytics professional on board who has expertise in GA4 implementation and troubleshooting.

  • Yes, you are correct. Usually, ‘piiRegex’ is used as a way to identify Personally Identifiable Information (PII) in a string through a regular expression, and it’s commonly used to filter out data like email addresses. The ‘piiRegex’ only replaces the value of an email if the value pattern matches an email because it’s specifically looking for patterns that match typical email formats for privacy reasons.

    As for the rest of your code, unfortunately, the code was not provided in your message, therefore I cannot assess its overall structure or potential issues. If you want me to check your JavaScript code, please repost your question and make sure to include the code you need help with.