Class: Consently::Providers::GoogleAnalytics
- Defined in:
- lib/consently/providers/google_analytics.rb
Overview
GA4. Pass anonymize: false to leave IP anonymisation off; it is on by
default because most European deployments want it.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
build, cookie, cookie_manifest, #cookies, google?, #google?, #initialize, #noscript, provider_key, provider_key=, register, registry, #to_s
Constructor Details
This class inherits a constructor from Consently::Providers::Base
Instance Method Details
#scripts ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/consently/providers/google_analytics.rb', line 17 def scripts [ Script.new(src: "https://www.googletagmanager.com/gtag/js?id=#{id}", async: true), Script.new(inline: <<~JS.strip) window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '#{id}'#{}); JS ] end |