Module: Middleman::FacebookPixel::Helpers

Defined in:
lib/middleman-facebook-pixel/helpers.rb

Instance Method Summary collapse

Instance Method Details

#facebook_pixelObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/middleman-facebook-pixel/helpers.rb', line 6

def facebook_pixel
  # get configuration options
  options = extensions[:facebook_pixel].options
  # path to Facebook Pixel template
  path = File.join(File.dirname(__FILE__), 'facebook-pixel.html.erb')
  # set template context
  context = {options: options}
  # init ERB engine
  erb = Erubis::FastEruby.new(File.read(path))
  # return compiled HTML
  erb.evaluate(context)
end