[contact-form-7 id="24078" title="Feedback EN"]

Featured templates

Monstroid. How to add Google Analytics code

This tutorial will guide you through adding Google Analytics code to Monstroid templates.

Getting Google Analytics code

  1. Sign into your Google Analytics account.

  2. Click the Admin tab.

  3. Select Account from the Account column.

  4. Select Property on the next column.

  5. Under Property select Tracking Info > Tracking Code option:

    Monstroid._How_to_add_Google_Analytics_code_1

  6. Copy Tracking code:

    Monstroid._How_to_add_Google_Analytics_code_2

Adding Google Analytics tracking code to your site.

  1. Log into your WordPress admin panel.

  2. Navigate to Cherry > Options section:

    Monstroid._How_to_add_Google_Analytics_code_3

  3. Enter you Tracking code to the Google Analytics code field under General tab:

    Monstroid._How_to_add_Google_Analytics_code_4

  4. Click Save options.

Note that Google Analytics block was added into Cherry Options starting from the template 55966 +. In case your template number is lower than 55966, follow the steps below:

  1. Open ‘wp-content/themes/themeXXXXX/functions.php’ file:

    Monstroid._How_to_add_Google_Analytics_code_5

  2. Add the following code to the very end of the file:

    add_filter( 'cherry_general_options_list', 'themeXXXX_new_settings' );
      function themeXXXX_new_settings( $options ) {
      $new_options = array(
      'google_analytics' => array(
      'type'        => 'textarea',
      'title'       => __( 'Google Analytics Code', 'themeXXXX' ),
      'description' => __( 'You can paste your Google Analytics or other tracking code in this box. This will be automatically added to the footer.', 'themeXXXX' ),
      'value'       => '',
      )
      );
      $options = array_merge( $options, $new_options );
     return $options;
      }
    add_filter( 'wp_footer', 'themeXXXX_google_analytics', 9999 );
      function themeXXXX_google_analytics () {
      if ( cherry_get_option( 'google_analytics' ) ) {
      echo '<script>'.cherry_get_option( 'google_analytics' ).'</script>';
      }
      }
    
    
  3. Save the changes.

  4. Clear your browser cache and navigate to Cherry Options > General tab. Google Analytics block should appear at the very bottom of the page.

  5. Enter you Tracking code to the Google Analytics code field under General tab:

    Monstroid._How_to_add_Google_Analytics_code_4

  6. Click Save options.

Feel free to check the detailed video tutorial below:

Monstroid. How to add Google Analytics code