Module: Workarea::GoogleTagManager
- Defined in:
- lib/workarea/google_tag_manager.rb,
lib/workarea/google_tag_manager/engine.rb,
lib/workarea/google_tag_manager/version.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- VERSION =
"4.3.2"
Class Method Summary collapse
- .config ⇒ Object
-
.configure_container ⇒ Object
TODO: Remove this method and fallback to secrets configuration in the next major, config via rails configuration is preferable and can be referenced directly in the view.
- .container_id ⇒ Object
- .container_id=(container_id) ⇒ Object
Class Method Details
.config ⇒ Object
56 57 58 |
# File 'lib/workarea/google_tag_manager.rb', line 56 def self.config Workarea.config.google_tag_manager end |
.configure_container ⇒ Object
TODO: Remove this method and fallback to secrets configuration in the next major, config via rails configuration is preferable and can be referenced directly in the view
13 14 15 16 17 18 19 20 21 |
# File 'lib/workarea/google_tag_manager.rb', line 13 def self.configure_container if Workarea.config.google_tag_manager_container_id.present? self.container_id = Workarea.config.google_tag_manager_container_id elsif Rails.application.secrets.google_tag_manager.present? secrets = Rails.application.secrets.google_tag_manager.deep_symbolize_keys self.container_id = secrets[:container_id] end end |
.container_id ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/workarea/google_tag_manager.rb', line 23 def self.container_id if Workarea.config.google_tag_manager.container_id.present? Workarea.config.google_tag_manager.container_id elsif Rails.application.secrets.google_tag_manager.present? = <<~WARN Setting Google Tag Manager containter id via secrets is deprecated. Set your container_id via Workarea.config Workarea.configure do |config| config.google_tag_manager.container_id = YOUR_CONTAINER_ID end WARN ActiveSupport::Deprecation.warn() Rails.application.secrets.google_tag_manager[:container_id] else @container_id end end |
.container_id=(container_id) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/workarea/google_tag_manager.rb', line 43 def self.container_id=(container_id) = <<~WARN Workarea::GoogleTagManager.container_id= is deprecated. Set your container_id via Workarea.config Workarea.configure do |config| config.google_tag_manager.container_id = YOUR_CONTAINER_ID end WARN ActiveSupport::Deprecation.warn() @container_id = container_id end |