class Rack::Tracker::GoogleAnalytics::EnhancedEcommerce

Public Instance Methods

write() click to toggle source
# File lib/rack/tracker/google_analytics/google_analytics.rb, line 30
def write
  hash = self.to_h
  label = hash[:label]
  attributes = hash.except(:label, :type).compact.stringify_values

  [
    "ec:#{self.type}",
    label,
    attributes.empty? ? nil : attributes
  ].compact.to_json.gsub(/\[|\]/, '')
end