def send_event_to_ga(category, action, label)
      # google_analytics_client_id is a UUID that identifies a particular client to the GA Measurement Protocol API
      if QuickSearch::Engine::APP_CONFIG['google_analytics_tracking_id'].blank? or QuickSearch::Engine::APP_CONFIG['google_analytics_client_id'].blank?
        return false
      end

      # Pass along the client user agent and IP address so it is associated
      # with the event in Google Analytics
      params = {
          v: 1,
          t: 'event',
          tid: QuickSearch::Engine::APP_CONFIG['google_analytics_tracking_id'],
          cid: QuickSearch::Engine::APP_CONFIG['google_analytics_client_id'],
          ec: category,
          ea: action,
          el: label,
          uip: request.remote_ip,
          ua: request.user_agent,
      }
  
      client = HTTPClient.new
      url = "https://www.google-analytics.com/collect?" + params.to_query

      # The measurement protocol API does not validate responses.
      # The best way to test this is testing the query string against:
      # https://ga-dev-tools.appspot.com/hit-builder/

      client.post(url)

    end
def send_event_to_ga(category, action, label)
      # google_analytics_client_id is a UUID that identifies a particular client to the GA Measurement Protocol API
      if QuickSearch::Engine::APP_CONFIG['google_analytics_tracking_id'].blank? or QuickSearch::Engine::APP_CONFIG['google_analytics_client_id'].blank?
        return false
      end

      # Pass along the client user agent and IP address so it is associated
      # with the event in Google Analytics
      params = {
          v: 1,
          t: 'event',
          tid: QuickSearch::Engine::APP_CONFIG['google_analytics_tracking_id'],
          cid: QuickSearch::Engine::APP_CONFIG['google_analytics_client_id'],
          ec: category,
          ea: action,
          el: label,
          uip: request.remote_ip,
          ua: request.user_agent,
      }
  
      client = HTTPClient.new
      url = "https://www.google-analytics.com/collect?" + params.to_query

      # The measurement protocol API does not validate responses.
      # The best way to test this is testing the query string against:
      # https://ga-dev-tools.appspot.com/hit-builder/

      client.post(url)

    end
Logs an event to Google Analytics using the Measurement Protocol API
 https://developers.google.com/analytics/devguides/collection/protocol/v1/