Class: Locomotive::Steam::Liquid::Tags::GoogleAnalytics

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/locomotive/steam/liquid/tags/google_analytics.rb

Constant Summary collapse

Syntax =
/(#{::Liquid::QuotedFragment}+)/o.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, options) ⇒ GoogleAnalytics

Returns a new instance of GoogleAnalytics.



11
12
13
14
15
16
17
18
19
# File 'lib/locomotive/steam/liquid/tags/google_analytics.rb', line 11

def initialize(tag_name, markup, options)
  super

  if markup =~ Syntax
    @account_id = ::Liquid::Expression.parse($1)
  else
    raise ::Liquid::SyntaxError.new("Syntax Error in 'google_analytics' - Valid syntax: google_analytics <account_id>")
  end
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



9
10
11
# File 'lib/locomotive/steam/liquid/tags/google_analytics.rb', line 9

def 
  @account_id
end

Instance Method Details

#render(context) ⇒ Object



21
22
23
# File 'lib/locomotive/steam/liquid/tags/google_analytics.rb', line 21

def render(context)
  ga_snippet(context.evaluate())
end