Sha256: c5161bb34d3a5baeef33e533bf92bb98daa76af8fffca553e4c7ad636f51f20b

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

class Rack::Tracker::FacebookPixel < Rack::Tracker::Handler
  class Event < OpenStruct
    def write
      options.present? ? type_to_json << options_to_json : type_to_json
    end

    private

    def type_to_json
      type.to_json
    end

    def options_to_json
      ", #{options.to_json}"
    end
  end

  self.position = :body

  def render
    Tilt.new( File.join( File.dirname(__FILE__), 'template/facebook_pixel.erb') ).render(self)
  end

  def self.track(name, *event)
    { name.to_s => [event.last.merge('class_name' => 'Event')] }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-tracker-1.3.1 lib/rack/tracker/facebook_pixel/facebook_pixel.rb
rack-tracker-1.3.0 lib/rack/tracker/facebook_pixel/facebook_pixel.rb
rack-tracker-1.2.0 lib/rack/tracker/facebook_pixel/facebook_pixel.rb