Class: FacebookAds::ServerSide::AttributionData
- Inherits:
-
Object
- Object
- FacebookAds::ServerSide::AttributionData
- Defined in:
- lib/facebook_ads/ad_objects/server_side/attribution_data.rb
Overview
AttributionData indicated the attribution data used for attribution passback event to optimize the performance.
Instance Attribute Summary collapse
-
#ad_id ⇒ Object
Meta-provided ad id from URL/deeplink.
-
#adset_id ⇒ Object
Meta-provided adset id from URL/deeplink.
-
#attr_window ⇒ Object
Attribution woindow in days.
-
#attribution_model ⇒ Object
Attribution model used to attribute the event.
-
#attribution_share ⇒ Object
- 0-1
-
weight of credit assigned to the visit.
-
#campaign_id ⇒ Object
Meta-provided campaign id from URL/deeplink.
-
#scope ⇒ Object
Touchpoint type.
-
#visit_time ⇒ Object
A Unix timestamp in seconds indicating when the campaign_id or fbc was first received.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#build(attributes = {}) ⇒ Object
build the object using the input hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(scope: nil, visit_time: nil, ad_id: nil, adset_id: nil, campaign_id: nil, attribution_share: nil, attribution_model: nil, attr_window: nil) ⇒ AttributionData
constructor
A new instance of AttributionData.
-
#normalize ⇒ Object
Normalize input fields to server request format.
- #to_s ⇒ Object
Constructor Details
#initialize(scope: nil, visit_time: nil, ad_id: nil, adset_id: nil, campaign_id: nil, attribution_share: nil, attribution_model: nil, attr_window: nil) ⇒ AttributionData
Returns a new instance of AttributionData.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 59 def initialize(scope: nil, visit_time: nil, ad_id: nil, adset_id: nil, campaign_id: nil, attribution_share: nil, attribution_model: nil, attr_window: nil) unless scope.nil? self.scope = scope end unless visit_time.nil? self.visit_time = visit_time end unless ad_id.nil? self.ad_id = ad_id end unless adset_id.nil? self.adset_id = adset_id end unless campaign_id.nil? self.campaign_id = campaign_id end unless attribution_share.nil? self.attribution_share = attribution_share end unless attribution_model.nil? self.attribution_model = attribution_model end unless attr_window.nil? self.attr_window = attr_window end end |
Instance Attribute Details
#ad_id ⇒ Object
Meta-provided ad id from URL/deeplink.
32 33 34 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 32 def ad_id @ad_id end |
#adset_id ⇒ Object
Meta-provided adset id from URL/deeplink.
35 36 37 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 35 def adset_id @adset_id end |
#attr_window ⇒ Object
Attribution woindow in days.
47 48 49 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 47 def attr_window @attr_window end |
#attribution_model ⇒ Object
Attribution model used to attribute the event.
44 45 46 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 44 def attribution_model @attribution_model end |
#attribution_share ⇒ Object
- 0-1
-
weight of credit assigned to the visit.
41 42 43 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 41 def attribution_share @attribution_share end |
#campaign_id ⇒ Object
Meta-provided campaign id from URL/deeplink.
38 39 40 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 38 def campaign_id @campaign_id end |
#scope ⇒ Object
Touchpoint type.
26 27 28 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 26 def scope @scope end |
#visit_time ⇒ Object
A Unix timestamp in seconds indicating when the campaign_id or fbc was first received.
29 30 31 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 29 def visit_time @visit_time end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 128 def ==(o) return true if self.equal?(o) self.class == o.class && scope == o.scope && visit_time == o.visit_time && ad_id == o.ad_id && adset_id == o.adset_id && campaign_id == o.campaign_id && attribution_share == o.attribution_share && attribution_model == o.attribution_model && attr_window == o.attr_window end |
#build(attributes = {}) ⇒ Object
build the object using the input hash
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 88 def build(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'scope') self.scope = attributes[:'scope'] end if attributes.has_key?(:'visit_time') self.visit_time = attributes[:'visit_time'] end if attributes.has_key?(:'ad_id') self.ad_id = attributes[:'ad_id'] end if attributes.has_key?(:'adset_id') self.adset_id = attributes[:'adset_id'] end if attributes.has_key?(:'campaign_id') self.campaign_id = attributes[:'campaign_id'] end if attributes.has_key?(:'attribution_share') self.attribution_share = attributes[:'attribution_share'] end if attributes.has_key?(:'attribution_model') self.attribution_model = attributes[:'attribution_model'] end if attributes.has_key?(:'attr_window') self.attr_window = attributes[:'attr_window'] end end |
#eql?(o) ⇒ Boolean
142 143 144 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 142 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
148 149 150 151 152 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 148 def hash [ scope, visit_time, ad_id, adset_id, campaign_id, attribution_share, attribution_model, attr_window ].hash end |
#normalize ⇒ Object
Normalize input fields to server request format.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 185 def normalize hash = {} unless scope.nil? hash['scope'] = scope end unless visit_time.nil? hash['visit_time'] = visit_time end unless ad_id.nil? hash['ad_id'] = ad_id end unless adset_id.nil? hash['adset_id'] = adset_id end unless campaign_id.nil? hash['campaign_id'] = campaign_id end unless attribution_share.nil? hash['attribution_share'] = attribution_share end unless attribution_model.nil? hash['attribution_model'] = attribution_model end unless attr_window.nil? hash['attr_window'] = attr_window end hash end |
#to_s ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/facebook_ads/ad_objects/server_side/attribution_data.rb', line 154 def to_s hash = {} unless scope.nil? hash['scope'] = scope end unless visit_time.nil? hash['visit_time'] = visit_time end unless ad_id.nil? hash['ad_id'] = ad_id end unless adset_id.nil? hash['adset_id'] = adset_id end unless campaign_id.nil? hash['campaign_id'] = campaign_id end unless attribution_share.nil? hash['attribution_share'] = attribution_share end unless attribution_model.nil? hash['attribution_model'] = attribution_model end unless attr_window.nil? hash['attr_window'] = attr_window end hash.to_s end |