Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #857708

    Google Analytics states the following

    This is the Global Site Tag (gtag.js) tracking code for this property. Copy and paste this code as the first item into the <HEAD> of every webpage you want to track. If you already have a Global Site Tag on your page, simply add the config line from the snippet below to your existing Global Site Tag.

    However, your Google services section inserts it at the bottom of the page. Is this a problem?

    #857877

    Hey xuamox,

    I’m not sure to be honest, does your Google service work or not? Please post a link to your site if you should need any further help.

    Best regards,
    Rikard

    #858285

    Yes, Google Analytics works fine.
    I was just more worried about things like events tracking, etc.
    Having some issues with events triggering from links

    #858787

    Hi,
    You could use the plugin GA Google Analytics it gives the option to use the header or footer.

    Best regards,
    Mike

    #860485

    Thanks for the help

    #860848

    Hi,

    Glad we could help. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #877722

    Hi Rikard.

    Can you please instruct on how to get Google’s new type of tracking code (Global Site Tag) to go into the Header and NOT the footer… using enfold’s functionality… and not by adding another plugin to do this.

    Thanks

    #878487

    Hi splashmediagroup,

    Here is the code you can put in your funtions.php

    
    <?php
    add_action('wp_head', 'add_googleanalytics');
    function add_googleanalytics() { ?>
    
     <!-- Global site tag (gtag.js) - Google Analytics -->
    
    
    <?php } ?>
    

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #878614

    Hi Victoria

    I’m not sure why you have the opening and closing php tags in your add_action code. All the other actions/functions I have in my function.php file don’t have this. I have one opening php tag at the top of the page, and then all my actions/functions go directly after it… none of which have their own opening and closing php tags.

    If I use the code you provided I would have to close my existing opening php tag, directly after all the current actions/functions I have… and then use your code.

    I could be very wrong, but please advise as this doesn’t seem correct.

    Thanks!

    #878624

    Hi,
    You would not need the first opening tag, but you will need the last opening tag as there is a closing tag in the function This is because the js script that you get from Google Analytics has to be outside of the php code. Please see this article.

    Best regards,
    Mike

    #879337

    Thanks for clarifying Mike.

    Works fine.

    #879469

    Hi,
    Glad to help, shall we close this then?

    Best regards,
    Mike

    #879860

    Good to close.
    Thanks!

    #880198

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Google Analytics tracking code not in HEAD’ is closed to new replies.