Module: Consently
- Defined in:
- lib/consently.rb,
lib/consently/cookie.rb,
lib/consently/engine.rb,
lib/consently/script.rb,
lib/consently/consent.rb,
lib/consently/version.rb,
lib/consently/configuration.rb,
lib/consently/providers/base.rb,
lib/consently/providers/custom.rb,
lib/consently/providers/hotjar.rb,
lib/consently/providers/clarity.rb,
app/helpers/consently/tags_helper.rb,
lib/consently/providers/plausible.rb,
lib/consently/providers/google_ads.rb,
lib/consently/providers/meta_pixel.rb,
app/models/consently/consent_record.rb,
app/models/consently/application_record.rb,
app/helpers/consently/application_helper.rb,
lib/consently/providers/google_analytics.rb,
lib/consently/providers/google_tag_manager.rb,
app/controllers/consently/consents_controller.rb,
lib/generators/consently/views/views_generator.rb,
app/controllers/consently/application_controller.rb,
lib/generators/consently/install/install_generator.rb,
lib/generators/consently/consent_log/consent_log_generator.rb
Overview
Tag snippets and cookie consent in one place.
Everything the host application needs goes through Consently.configure;
the views ask this module what to render for the current request.
Defined Under Namespace
Modules: ApplicationHelper, Generators, Providers, TagsHelper Classes: ApplicationController, ApplicationRecord, Configuration, Consent, ConsentRecord, ConsentsController, Cookie, Engine, Error, MissingOption, Script, UnknownProvider
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
- .config ⇒ Object
- .configure {|config| ... } ⇒ Object
-
.consent_required?(request = nil) ⇒ Boolean
Whether this visitor has to be asked.
- .enabled?(request = nil) ⇒ Boolean
-
.reset! ⇒ Object
Mostly for tests and for reloading an initializer in development.
- .scope_for(request) ⇒ Object
-
.tags_for(request = nil) ⇒ Object
Tags configured for this request: the defaults, plus whatever the matching scope adds or overrides.
Class Method Details
.config ⇒ Object
37 38 39 |
# File 'lib/consently.rb', line 37 def config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
32 33 34 35 |
# File 'lib/consently.rb', line 32 def configure yield config config end |
.consent_required?(request = nil) ⇒ Boolean
Whether this visitor has to be asked. When they do not, every category counts as granted and no banner is rendered - see config.consent_required.
64 65 66 |
# File 'lib/consently.rb', line 64 def (request = nil) resolve(config., request) end |
.enabled?(request = nil) ⇒ Boolean
58 59 60 |
# File 'lib/consently.rb', line 58 def enabled?(request = nil) resolve(config.enabled, request) end |
.reset! ⇒ Object
Mostly for tests and for reloading an initializer in development.
42 43 44 |
# File 'lib/consently.rb', line 42 def reset! @config = Configuration.new end |
.scope_for(request) ⇒ Object
52 53 54 55 56 |
# File 'lib/consently.rb', line 52 def scope_for(request) return nil unless config.scope_resolver && request config.scope_resolver.call(request) end |
.tags_for(request = nil) ⇒ Object
Tags configured for this request: the defaults, plus whatever the matching scope adds or overrides.
48 49 50 |
# File 'lib/consently.rb', line 48 def (request = nil) config.(scope_for(request)) end |