Class: Consently::Providers::GoogleAds

Inherits:
Base
  • Object
show all
Defined in:
lib/consently/providers/google_ads.rb

Constant Summary

Constants inherited from Base

Base::SAFE_OPTION

Instance Attribute Summary

Attributes inherited from Base

#category, #key, #options

Instance Method Summary collapse

Methods inherited from Base

build, cookie, cookie_manifest, #cookies, #initialize, #noscript, provider_key, provider_key=, register, registry, #to_s

Constructor Details

This class inherits a constructor from Consently::Providers::Base

Instance Method Details

#scriptsObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/consently/providers/google_ads.rb', line 9

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