Class: TradeTracker::Click
- Inherits:
-
Object
- Object
- TradeTracker::Click
- Defined in:
- lib/trade_tracker/click.rb
Instance Attribute Summary collapse
-
#affiliate_id ⇒ Object
Returns the value of attribute affiliate_id.
-
#campaign_id ⇒ Object
Returns the value of attribute campaign_id.
-
#material_id ⇒ Object
Returns the value of attribute material_id.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#reference ⇒ Object
Returns the value of attribute reference.
Instance Method Summary collapse
- #cookie_name ⇒ Object
- #cookie_value ⇒ Object
-
#initialize(params) ⇒ Click
constructor
A new instance of Click.
- #trackback_url ⇒ Object
Constructor Details
#initialize(params) ⇒ Click
Returns a new instance of Click.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/trade_tracker/click.rb', line 6 def initialize(params) if params[:campaignID] self.campaign_id = params[:campaignID] self.material_id = params[:material_id] self.affiliate_id = params[:affiliate_id] self.redirect_url = params[:redirect_url] elsif params[:tt] tracking_data = params[:tt].split('_') self.campaign_id = tracking_data[0] self.material_id = tracking_data[1] self.affiliate_id = tracking_data[2] self.reference = tracking_data[3] self.redirect_url = params[:r] end end |
Instance Attribute Details
#affiliate_id ⇒ Object
Returns the value of attribute affiliate_id.
3 4 5 |
# File 'lib/trade_tracker/click.rb', line 3 def affiliate_id @affiliate_id end |
#campaign_id ⇒ Object
Returns the value of attribute campaign_id.
3 4 5 |
# File 'lib/trade_tracker/click.rb', line 3 def campaign_id @campaign_id end |
#material_id ⇒ Object
Returns the value of attribute material_id.
3 4 5 |
# File 'lib/trade_tracker/click.rb', line 3 def material_id @material_id end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
3 4 5 |
# File 'lib/trade_tracker/click.rb', line 3 def redirect_url @redirect_url end |
#reference ⇒ Object
Returns the value of attribute reference.
3 4 5 |
# File 'lib/trade_tracker/click.rb', line 3 def reference @reference end |
Instance Method Details
#cookie_name ⇒ Object
49 50 51 |
# File 'lib/trade_tracker/click.rb', line 49 def "TT2_#{campaign_id}" end |
#cookie_value ⇒ Object
53 54 55 |
# File 'lib/trade_tracker/click.rb', line 53 def "#{material_id}::#{affiliate_id}::#{reference}::#{checksum}::#{Time.now.to_i}" end |
#trackback_url ⇒ Object
43 44 45 46 47 |
# File 'lib/trade_tracker/click.rb', line 43 def trackback_url if campaign_id.present? || affiliate_id.present? "http://tc.tradetracker.net/?c=#{campaign_id}&m=#{material_id}&a=#{affiliate_id}&r=#{reference}&u=#{redirect_url}" end end |