Module: Bacchanalytics::AdwordsConversionTrackingCode
- Included in:
- AdwordsConversion
- Defined in:
- lib/bacchanalytics/adwords_conversion.rb
Instance Method Summary collapse
-
#adwords_tracking_code(page, conversions = []) ⇒ Object
Construct the Adwords conversion tracking code.
Instance Method Details
#adwords_tracking_code(page, conversions = []) ⇒ Object
Construct the Adwords conversion tracking code.
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 |
# File 'lib/bacchanalytics/adwords_conversion.rb', line 6 def adwords_tracking_code(page, conversions=[]) return if page.blank? tracking_code = "" conversions.each do |conversion| begin next unless valid_conversion?(conversion) # Check the requested page, to include the A, B or goal tracking code. if conversion[:pages].include?(page) cid = conversion[:id] label = conversion[:label] description = conversion[:description] || 'adwords conversion' language = conversion[:language] || 'en' format = conversion[:format] || 3 value = conversion[:value] || 0 tracking_code = conversion_code(cid, label, language, format, value, description) break end rescue tracking_code = "" end end tracking_code end |