Class: FacebookAds::ServerSide::AppData

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook_ads/ad_objects/server_side/app_data.rb

Overview

AppData which contains app data and device information for events happening from an app.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application_tracking_enabled: nil, advertiser_tracking_enabled: nil, consider_views: nil, extinfo: nil, include_dwell_data: nil, include_video_data: nil, install_referrer: nil, installer_package: nil, url_schemes: nil, windows_attribution_id: nil, campaign_ids: nil) ⇒ AppData

Returns a new instance of AppData.

Parameters:

  • application_tracking_enabled (Boolean) (defaults to: nil)
  • advertiser_tracking_enabled (Boolean) (defaults to: nil)
  • consider_views (Boolean) (defaults to: nil)
  • extinfo (ExtendedDeviceInfo) (defaults to: nil)
  • include_dwell_data (Boolean) (defaults to: nil)
  • include_video_data (Boolean) (defaults to: nil)
  • install_referrer (String) (defaults to: nil)
  • installer_package (String) (defaults to: nil)
  • url_schemes (Array<String>) (defaults to: nil)
  • windows_attribution_id (String) (defaults to: nil)
  • campaign_ids (String) (defaults to: nil)


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 67

def initialize(application_tracking_enabled: nil,
  advertiser_tracking_enabled: nil,
  consider_views: nil,
  extinfo: nil,
  include_dwell_data: nil,
  include_video_data: nil,
  install_referrer: nil,
  installer_package: nil,
  url_schemes: nil,
  windows_attribution_id: nil,
  campaign_ids: nil)

  unless application_tracking_enabled.nil?
    self.application_tracking_enabled = application_tracking_enabled
  end
  unless advertiser_tracking_enabled.nil?
    self.advertiser_tracking_enabled = advertiser_tracking_enabled
  end
  unless consider_views.nil?
    self.consider_views = consider_views
  end
  unless extinfo.nil?
    self.extinfo = extinfo
  end
  unless include_dwell_data.nil?
    self.include_dwell_data = include_dwell_data
  end
  unless include_video_data.nil?
    self.include_video_data = include_video_data
  end
  unless install_referrer.nil?
    self.install_referrer = install_referrer
  end
  unless installer_package.nil?
    self.installer_package = installer_package
  end
  unless url_schemes.nil?
    self.url_schemes = url_schemes
  end
  unless windows_attribution_id.nil?
    self.windows_attribution_id = windows_attribution_id
  end
  unless campaign_ids.nil?
    self.campaign_ids = campaign_ids
  end
end

Instance Attribute Details

#advertiser_tracking_enabledObject

A person can choose to enable ad tracking on an app level. Your SDK should allow an app developer to put an opt-out setting into their app. Use this field to specify the person’s choice. Use 0 for disabled, 1 for enabled. ‘



27
28
29
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 27

def advertiser_tracking_enabled
  @advertiser_tracking_enabled
end

#application_tracking_enabledObject

Use this field to specify ATT permission on an iOS 14.5+ device. Set to 0 for disabled or 1 for enabled.



24
25
26
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 24

def application_tracking_enabled
  @application_tracking_enabled
end

#campaign_idsObject

An encrypted string and non-user metadata appended to the outbound URL (for example, ad_destination_url) or deep link (for App Aggregated Event Manager) when a user clicked on a link from Facebook.



54
55
56
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 54

def campaign_ids
  @campaign_ids
end

#consider_viewsObject

Specifies that view through data should be considered when determining the ad to attribute this install to. Clicks will always be considered first before views and views will only be returned if there was not a click on an ad for the app



30
31
32
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 30

def consider_views
  @consider_views
end

#extinfoObject

Extended device information, such as screen width and height.



33
34
35
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 33

def extinfo
  @extinfo
end

#include_dwell_dataObject

Specifies that view dwell ms should be returned as part of view through data



36
37
38
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 36

def include_dwell_data
  @include_dwell_data
end

#include_video_dataObject

Specifies that video view completion percentages should be returned as part of view through data



39
40
41
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 39

def include_video_data
  @include_video_data
end

#install_referrerObject

Third party install referrer, currently available for Android only, see here for more.



42
43
44
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 42

def install_referrer
  @install_referrer
end

#installer_packageObject

Used internally by the Android SDKs



45
46
47
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 45

def installer_package
  @installer_package
end

#url_schemesObject

Used internally by the iOS and Android SDKs.



48
49
50
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 48

def url_schemes
  @url_schemes
end

#windows_attribution_idObject

Attribution token used for Windows 10.



51
52
53
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 51

def windows_attribution_id
  @windows_attribution_id
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 169

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      application_tracking_enabled == o.application_tracking_enabled &&
      advertiser_tracking_enabled == o.advertiser_tracking_enabled &&
      consider_views == o.consider_views &&
      extinfo == o.extinfo &&
      include_dwell_data == o.include_dwell_data &&
      include_video_data == o.include_video_data &&
      install_referrer == o.install_referrer &&
      installer_package == o.installer_package &&
      url_schemes == o.url_schemes &&
      windows_attribution_id == o.windows_attribution_id &&
      campaign_ids == o.campaign_ids
end

#build(attributes = {}) ⇒ Object

build the object using the input hash

Parameters:

  • attributes (Hash) (defaults to: {})

    attributes in the form of hash



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 116

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?(:'application_tracking_enabled')
    self.application_tracking_enabled = attributes[:'application_tracking_enabled']
  end

  if attributes.has_key?(:'advertiser_tracking_enabled')
    self.advertiser_tracking_enabled = attributes[:'advertiser_tracking_enabled']
  end

  if attributes.has_key?(:'consider_views')
    self.consider_views = attributes[:'consider_views']
  end

  if attributes.has_key?(:'extinfo')
    self.extinfo = attributes[:'extinfo']
  end

  if attributes.has_key?(:'include_dwell_data')
    self.include_dwell_data = attributes[:'include_dwell_data']
  end


  if attributes.has_key?(:'include_video_data')
    self.include_video_data = attributes[:'include_video_data']
  end

  if attributes.has_key?(:'install_referrer')
    self.install_referrer = attributes[:'install_referrer']
  end

  if attributes.has_key?(:'installer_package')
    self.installer_package = attributes[:'installer_package']
  end

  if attributes.has_key?(:'url_schemes')
    self.url_schemes = attributes[:'url_schemes']
  end

  if attributes.has_key?(:'windows_attribution_id')
    self.windows_attribution_id = attributes[:'windows_attribution_id']
  end

  if attributes.has_key?(:'campaign_ids')
    self.campaign_ids = attributes[:'campaign_ids']
  end
end

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • `==` method


186
187
188
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 186

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 192

def hash
  [
      application_tracking_enabled,
      advertiser_tracking_enabled,
      consider_views,
      extinfo,
      include_dwell_data,
      include_video_data,
      install_referrer,
      installer_package,
      url_schemes,
      windows_attribution_id,
      campaign_ids
  ].hash
end

#normalizeObject

Normalize input fields to server request format.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 249

def normalize
  hash = {}
  unless application_tracking_enabled.nil?
    hash['application_tracking_enabled'] = application_tracking_enabled
  end
  unless advertiser_tracking_enabled.nil?
    hash['advertiser_tracking_enabled'] = advertiser_tracking_enabled
  end
  unless consider_views.nil?
    hash['consider_views'] = consider_views
  end
  unless include_dwell_data.nil?
    hash['include_dwell_data'] = include_dwell_data
  end
  unless include_video_data.nil?
    hash['include_video_data'] = include_video_data
  end
  unless install_referrer.nil?
    hash['install_referrer'] = install_referrer
  end
  unless installer_package.nil?
    hash['installer_package'] = installer_package
  end
  unless url_schemes.nil?
    hash['url_schemes'] = url_schemes
  end
  unless windows_attribution_id.nil?
    hash['windows_attribution_id'] = windows_attribution_id
  end
  unless campaign_ids.nil?
    hash['campaign_ids'] = campaign_ids
  end

  unless extinfo.nil?
    hash['extinfo'] = extinfo.normalize
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/facebook_ads/ad_objects/server_side/app_data.rb', line 210

def to_s
  hash = {}
  unless vapplication_tracking_enabledalue.nil?
    hash['application_tracking_enabled'] = application_tracking_enabled
  end
  unless advertiser_tracking_enabled.nil?
    hash['advertiser_tracking_enabled'] = advertiser_tracking_enabled
  end
  unless consider_views.nil?
    hash['consider_views'] = consider_views
  end
  unless extinfo.nil?
    hash['extinfo'] = extinfo.to_s
  end
  unless include_dwell_data.nil?
    hash['include_dwell_data'] = include_dwell_data
  end
  unless include_video_data.nil?
    hash['include_video_data'] = include_video_data
  end
  unless install_referrer.nil?
    hash['install_referrer'] = install_referrer
  end
  unless installer_package.nil?
    hash['installer_package'] = installer_package
  end
  unless url_schemes.nil?
    hash['url_schemes'] = url_schemes.to_s
  end
  unless windows_attribution_id.nil?
    hash['windows_attribution_id'] = windows_attribution_id
  end
  unless campaign_ids.nil?
    hash['campaign_ids'] = campaign_ids
  end
  hash.to_s
end