6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/ads/rails/action_view/base.rb', line 6
def google_adsense_include_tag(*args)
options = args.
if ::Rails.env.production?
variables = options.map do |key, value|
if value.is_a? String
value = "'#{value}'"
end
"google_ad_#{key} = #{value};"
end
content_tag(
:script,
variables.join("\n").html_safe,
type: 'text/javascript'
) +
content_tag(
:script,
nil,
type: 'text/javascript',
src: "#{request.protocol}pagead2.googlesyndication.com/pagead/show_ads.js"
)
elsif Ads.config.renderer.is_a? Proc
instance_exec options, &Ads.config.renderer
else
content_tag(
:div,
nil,
style: "width:#{options[:width]}px;height:#{options[:height]}px;background:#c8c8c8;"
)
end
end
|