class Bridgetown::Plausible::Builder
Public Instance Methods
build()
click to toggle source
# File lib/bridgetown-plausible/builder.rb, line 6 def build liquid_tag "plausible" do |_attributes, tag| render end helper "plausible" do render end end
Private Instance Methods
markup_for_domain(domain)
click to toggle source
# File lib/bridgetown-plausible/builder.rb, line 33 def markup_for_domain(domain) "<script async defer data-domain=\"#{domain}\" src=\"https://plausible.io/js/plausible.js\"></script>" end
options()
click to toggle source
# File lib/bridgetown-plausible/builder.rb, line 41 def options config["plausible"] || {} end
render()
click to toggle source
# File lib/bridgetown-plausible/builder.rb, line 18 def render domain = options.dig(:domain)&.strip tag = if domain markup_for_domain(domain) else Bridgetown.logger.warn "Plausible", "Domain not configured." markup_for_domain("NOT CONFIGURED") end return wrap_with_comment(tag) unless Bridgetown.environment.production? tag end
wrap_with_comment(tag)
click to toggle source
# File lib/bridgetown-plausible/builder.rb, line 37 def wrap_with_comment(tag) "<!-- #{tag} -->" end