Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #914091
    Matt N
    Participant

    Hi there,

    My Google Analytics was working fine for a while, but is not anymore and I don’t know why.
    I have re-pasted the following script in the javascript section of the customizer. However, it is still not working.

      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
      ga('create', 'UA-57703680-1', 'auto');
      ga('send', 'pageview');

    Thank you in advance for your help.

    Matt

    #914092
    Matt N
    Participant
    This reply has been marked as private.
    #914472
    Joao
    Moderator

    Hi Matt,

    We have a Google Analytics Addon specially made for that.

    Please remove this code from the Customizer

    Install the Analytics Addon at your Wp-Admin/ Addons / Extensions

    Click on the addon (make sure it is enabled)

    Select Enable Google Analytics

    Paste your code below.

    Please see attached image.

    Hope that helps,

    Joao

    #982051
    Matt N
    Participant

    Hi Joao,

    Thank you for your answer.
    I have followed your advice last week. I have waited for a few days, but I still can’t see any statistics in my google analytics.

    Have I missed something?

    Thanks.

    Matt

    #982233
    Christian
    Moderator

    Hey Matt,

    I checked your site and looks like your setup is correct. Would you mind clearing all caches and deactivating all third party plugins then see if your analytics works? Next, you could try switching to the default 2016 theme and then test again.

    Thanks.

    #986032
    Matt N
    Participant

    Hi there,

    I have cleared the caches and deactivating all my third party plugins, but i still can’t see any data in GA.
    What do you mean by switching to the default 2016 theme?
    Should i activate the X-theme instead of the X-Child Theme

    Thanks

    Matt

    #986193
    Rupok
    Member

    Hi Matt,

    If you are using Child Theme then you can try switching to X first. If it’s still the same then activate 2016 to check if this is related to theme or not.

    Cheers!

    #989425
    Matt N
    Participant

    Hi There,

    I now have a bigger issue. I have followed your advice.
    Because Google Analytics was still not working, even with the Main Theme,, I have reactivated my child theme.
    Unfortunately, now, I cannot reach my WordPress portal anymore.
    “The page is not working”

    Could you please tell me what to do?

    Thanks

    Matt

    #989440
    Matt N
    Participant
    This reply has been marked as private.
    #989458
    Christopher
    Moderator

    Hi there,

    Please connect to FTP and update your child theme’s functions.php file to :

    function x_get_content_layout() {
    
        $content_layout = x_get_option( 'x_layout_content', 'content-sidebar' );
    
        if ( $content_layout != 'full-width' ) {
          if ( is_home() ) {
            $opt    = x_get_option( 'x_blog_layout', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_singular( 'post' ) ) {
            $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
            $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
          } elseif ( x_is_portfolio_item() ) {
            $layout = 'content-sidebar';
          } elseif ( x_is_portfolio() ) {
            $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
            $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
          } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
            $layout = 'content-sidebar';
          } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
            $layout = 'sidebar-content';
          } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
            $layout = 'full-width';
          } elseif ( is_archive() ) {
            if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
              $opt    = x_get_option( 'x_woocommerce_shop_layout_content', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            } else {
              $opt    = x_get_option( 'x_archive_layout', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            }
          } elseif ( x_is_product() ) {
            $layout = 'full-width';
          } elseif ( x_is_bbpress() ) {
            $opt    = x_get_option( 'x_bbpress_layout_content', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( x_is_buddypress() ) {
            $opt    = x_get_option( 'x_buddypress_layout_content', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_404() ) {
            $layout = 'full-width';
          } else {
            $layout = $content_layout;
          }
        } else {
          $layout = $content_layout;
        }
        
        return $layout;
    add_action('do_signup_header','add_signup_header_body_class');
    
    function add_signup_header_body_class() {
        add_filter('body_class', 'add_registration_page_class');    
    }
    
    function add_registration_page_class($classes) {
        $classes[] = 'signup-header';
        return $classes;
    }
    $mu_flag_login_page = false;
    
    add_action('signup_header','mu_flag_login_page');
    
    function mu_flag_login_page() {
      global $mu_flag_login_page;
      $mu_flag_login_page = true;
    }
    
    function is_mu_login_page() {
      global $mu_flag_login_page;
      return $mu_flag_login_page;
    }
    add_filter('get_post_metadata','no_revslider_on_login_page',10,4);
    function no_revslider_on_login_page($null,$object_id,$key,$single) {
        if( ('_x_slider_above' == $key || '_x_slider_below' == $key ) && is_mu_login_page()) {
        return false;
        }
        return $null;
    }
      }
      add_action('x_after_view_global__content', 'add_post_tags');
    add_action('x_after_view_global__content-the-content', 'add_post_tags');
    function add_post_tags() {
    if( is_singular('post') ) {
     if ( has_tag() ) : ?>
      <footer class="entry-footer cf">
        <?php echo get_the_tag_list( '<p><i class="x-icon-tags"></i> Tags: ', ', ', '</p>' ); ?>
      </footer>
    <?php endif;
    }
    }

    Hope it helps.

    #989461
    Matt N
    Participant
    This reply has been marked as private.
    #989488
    Christopher
    Moderator

    Hi there,

    Google analytics code is added in your site, please see the attachment.

    You can also install google analytics plugin from X Addons page.

    Hope it helps.

    #989560
    Matt N
    Participant

    Problem resolved.

    Thanks a lot guys

    #989629
    Joao
    Moderator

    You are welcome.

    Let us know if you need further help with anything.

    Joao

  • <script> jQuery(function($){ $("#no-reply-914091 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>