Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1280371

    I have tried adding the Google Analytics tag (V4) to the Enfold Child config but this does not seem to be working. I also searched the forum and found a possible solution to add the code to functions.php – this does not appear to be working either

    Please help
    Thanks

    #1280733

    Hey drinell,

    It should work using a function in your functions.php file:

    function add_ga_v_4(){
    ?>
    YOUR CODE GOES HERE
    <?php
    }
    add_action('wp_head', 'add_ga_v_4');

    If you need further help then please provide us with details to where we can see and reproduce the problem you are having.

    Best regards,
    Rikard

    #1281499

    I tried all flavors of that – ended up having to copy header.php from the enfold theme directory and add the code there – it is working now

    Any idea when you will have support for the GA 4 tracking codes directly in the theme?

    #1281709

    Hi drinell,

    You need to set up proper cookies for the analytics to work.

    Best regards,
    Victoria

    #1282610

    Can I suggest that you publish some documentation about how this is supposed to work with the theme ? I have seen and read through multiple questions and posts on this topic in multiple languages, …

    1 – Does the built-in Google Analytics tag functionality work with the new GA 4 tags or not? I have seen posts stating that it does not but that support is coming in a future update?

    2 – where is the correct place to put the google-supplied code? I tried the functions.php method and it did not work for me – I ended up having to put it in header.php?

    3 – What Privacy / Cookie settings need to be set for this to work with #1 or #2 ?

    Thanks

    #1283413

    Hi,

    Thank you for the update.

    1.) Yes, the analytics field should also work for the latest GA4 tag as described in the avia_get_tracking_code function inside the functions-enfold.php file.

    	/**
    	 * Make google analytics code work, even if the user only enters the UA id (UA-[0-9]*-[0-9]*).
    	 * With 4.8 support is extended for new GA4 tracking code G-[0-9A-Za-z] (Jan. 2021 - https://github.com/KriesiMedia/wp-themes/issues/3032 )
    	 * 
    	 * The async tracking code is placed in the header (GDPR is supported to only load when allowed).
    	 * 
    	 * @return void
    	 */
    

    2-3.) It should be added in the Enfold > Google Services > Google Analytics field, which also ensures that the privacy settings for it will also work. We could add it using wp_head hook or by putting it directly in the template (header.php file), but the designated privacy settings will not work.

    Best regards,
    Ismael

    #1283452

    I think see the issue – I am still on 4.7.6.4 – Theme is stating I am on the latest version when I check for updates – when will 4.8 be released?

    Which Cookie / Privacy Setting(s) are required for this to work properly?

    I currently have the following set:
    – Enable Cookie Consent Messages
    – All cookies and services are accepted on first page load, user can opt out

    When I upgrade to 4.8 (when available), the built-in support for GA4 tracking should work with these settings?

    #1283861

    Hi,

    Sorry about that. The latest version 4.8 is not available yet, which is probably why GA4 is not working in your installation. Please look for the avia_get_tracking_code and the avia_print_tracking_code functions inside the functions-enfold.php file, remove them and replace them with the following code instead.

    // https://pastebin.com/KBC9jrUJ

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.