Module: Barion::PixelHelper
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- app/helpers/barion/pixel_helper.rb
Overview
Provides functions for Barion Pixel implementations in views
Instance Method Summary collapse
Instance Method Details
#pixel_basic_js ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/barion/pixel_helper.rb', line 10 def pixel_basic_js javascript_tag %( window["bp"] = window["bp"] || function () {(window["bp"].q = window["bp"].q || []).push(arguments);}; window["bp"].l = 1 * new Date(); scriptElement = document.createElement("script"); firstScript = document.getElementsByTagName("script")[0]; scriptElement.async = true; scriptElement.src = 'https://pixel.barion.com/bp.js'; firstScript.parentNode.insertBefore(scriptElement, firstScript); window['barion_pixel_id'] = '#{::Barion.config.pixel_id}'; // Send init event bp('init', 'addBarionPixelId', window['barion_pixel_id']);' ).gsub!(/^#{[/\A\s*/]}/, '') end |
#pixel_basic_noscript ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/helpers/barion/pixel_helper.rb', line 25 def pixel_basic_noscript tag.noscript do tag.img height: 1, width: 1, style: 'display:none', alt: 'Barion Pixel', src: "https://pixel.barion.com/a.gif?ba_pixel_id='#{::Barion.config.pixel_id}'&ev=contentView&noscript=1" end end |
#pixel_basic_tags ⇒ Object
34 35 36 |
# File 'app/helpers/barion/pixel_helper.rb', line 34 def pixel_basic_js + pixel_basic_noscript end |