/**
  * Init and hook in the integration.
  *
  * @return void
  */
 public function __construct()
 {
     $this->id = 'google_analytics';
     $this->method_title = __('Google Analytics', 'woocommerce-google-analytics-integration');
     $this->method_description = __('Google Analytics is a free service offered by Google that generates detailed statistics about the visitors to a website.', 'woocommerce-google-analytics-integration');
     $this->dismissed_info_banner = get_option('woocommerce_dismissed_info_banner');
     // Load the settings
     $this->init_form_fields();
     $this->init_settings();
     $constructor = $this->init_options();
     // Contains snippets/JS tracking code
     include_once 'class-wc-google-analytics-js.php';
     WC_Google_Analytics_JS::get_instance($constructor);
     // Display an info banner on how to configure WooCommerce
     if (is_admin()) {
         include_once 'class-wc-google-analytics-info-banner.php';
         WC_Google_Analytics_Info_Banner::get_instance($this->dismissed_info_banner, $this->ga_id);
     }
     // Admin Options
     add_filter('woocommerce_tracker_data', array($this, 'track_options'));
     add_action('woocommerce_update_options_integration_google_analytics', array($this, 'process_admin_options'));
     add_action('woocommerce_update_options_integration_google_analytics', array($this, 'show_options_info'));
     add_action('admin_enqueue_scripts', array($this, 'load_admin_assets'));
     // Tracking code
     add_action('wp_head', array($this, 'tracking_code_display'), 999999);
     // Event tracking code
     add_action('woocommerce_after_add_to_cart_button', array($this, 'add_to_cart'));
     add_action('wp_footer', array($this, 'loop_add_to_cart'));
     add_action('woocommerce_after_cart', array($this, 'remove_from_cart'));
     add_action('woocommerce_after_mini_cart', array($this, 'remove_from_cart'));
     add_filter('woocommerce_cart_item_remove_link', array($this, 'remove_from_cart_attributes'), 10, 2);
     add_action('woocommerce_after_shop_loop_item', array($this, 'listing_impression'));
     add_action('woocommerce_after_shop_loop_item', array($this, 'listing_click'));
     add_action('woocommerce_after_single_product', array($this, 'product_detail'));
     add_action('woocommerce_after_checkout_form', array($this, 'checkout_process'));
     // utm_nooverride parameter for Google AdWords
     add_filter('woocommerce_get_return_url', array($this, 'utm_nooverride'));
 }
 /**
  * Get the class instance
  */
 public static function get_instance($dismissed = false, $ga_id = '')
 {
     return null === self::$instance ? self::$instance = new self($dismissed, $ga_id) : self::$instance;
 }