Sha256: a72cd899c0413f50cc0e1ae6fe86799875c21e3116732fb93d0b63405b932a19

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

module Applicants
  class AffiliateTracking < ActiveRecord::Base
    belongs_to :applicant

    attr_accessible :affiliate_id,
      :transaction_id,
      :affiliate_sub_id

    # HasOffers offer id generated and given by Ethan Allen
    # It is generated for this HasOffers event in a new tester workflow
    # In this case, the HasOffers event is after an "Applicant video upload"
    HAS_OFFERS_OFFER_ID = 2

    # HasOffers goal id generated and given by Ethan Allen
    # Tracks how far along the new tester workflow a tester has gotten.
    # One stage of it is "Applicant video upload" and the 2nd stage is
    # after they are approved (which is tracked in the Orders app)
    HAS_OFFERS_GOAL_ID = 4

    def self.has_offers_offer_url(transaction_id)
      return if transaction_id.blank?

      # HasOffers offer url as defined in the documentation
      # http://support.hasoffers.com/hc/en-us/articles/203338487-Postback-Tracking
      # Order of query string parameters is important
      # Example: http://usertesting.go2cloud.org/aff_lsr?offer_id=2&transaction_id=TRANSACTION_ID
      URI("http://usertesting.go2cloud.org/aff_lsr?offer_id=#{HAS_OFFERS_OFFER_ID}&transaction_id=#{transaction_id}")
    end

    def self.has_offers_goal_url(transaction_id)
      return if transaction_id.blank?

      # HasOffers goal url as defined in the documentation
      # http://support.hasoffers.com/hc/en-us/articles/203338487-Postback-Tracking
      # Order of query string parameters is important
      # Example: http://usertesting.go2cloud.org/aff_goal?a=lsr&goal_id=4&transaction_id=TRANSACTION_ID
      URI("http://usertesting.go2cloud.org/aff_goal?a=lsr&goal_id=#{HAS_OFFERS_GOAL_ID}&transaction_id=#{transaction_id}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
applicants-0.11.0 app/models/applicants/affiliate_tracking.rb