Sha256: e78d4a80c44157ef7bb360bcf50d4e53413fa34449077a3423eab40931748bf4
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
module Liquid class GoogleAnalytics < Liquid::Tag TEMPLATE = <<-EOF <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', '%s', 'auto'); ga('send', 'pageview'); </script> EOF def initialize(tag_name, tracking_code, tokens) super @tracking_code = tracking_code.to_s end def render(context) if context['tracking_code'] format(TEMPLATE, context['tracking_code']) elseif @tracking_code format(TEMPLATE, @tracking_code) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
liquid-google-analytics-1.0.0 | lib/liquid/google_analytics.rb |