Class: Spaceship::Tunes::AppAnalytics

Inherits:
TunesBase show all
Defined in:
spaceship/lib/spaceship/tunes/app_analytics.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TunesBase

client

Methods inherited from Base

attr_accessor, attr_mapping, #attributes, attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#apple_idInteger

Returns The app ID to grab analytics for.

Returns:

  • (Integer)

    The app ID to grab analytics for



7
8
9
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 7

def apple_id
  @apple_id
end

Class Method Details

.factory(attrs) ⇒ Object



10
11
12
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 10

def factory(attrs)
  return self.new(attrs)
end

Instance Method Details

#app_active_devicesObject

Usage / Active Devices



72
73
74
75
76
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 72

def app_active_devices
  start_t, end_t = time_last_7_days

  app_active_devices_interval(start_t, end_t)
end

#app_active_devices_interval(start_t, end_t, view_by = nil) ⇒ Object



128
129
130
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 128

def app_active_devices_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['activeDevices'], start_t, end_t, "DAY", view_by)
end

#app_active_last_30_daysObject

Usage / Active Devices 30 Days



79
80
81
82
83
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 79

def app_active_last_30_days
  start_t, end_t = time_last_7_days

  app_active_last_30_days_interval(start_t, end_t)
end

#app_active_last_30_days_interval(start_t, end_t, view_by = nil) ⇒ Object



132
133
134
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 132

def app_active_last_30_days_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['rollingActiveDevices'], start_t, end_t, "DAY", view_by)
end

#app_crashesObject

Usage / Crashes



86
87
88
89
90
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 86

def app_crashes
  start_t, end_t = time_last_7_days

  app_crashes_interval(start_t, end_t)
end

#app_crashes_interval(start_t, end_t, view_by = nil) ⇒ Object



136
137
138
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 136

def app_crashes_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['crashes'], start_t, end_t, "DAY", view_by)
end

#app_impressionsObject

App Store / Impressions Unique Devices



16
17
18
19
20
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 16

def app_impressions
  start_t, end_t = time_last_7_days

  app_impressions_interval(start_t, end_t)
end

#app_impressions_interval(start_t, end_t, view_by = nil) ⇒ Object



96
97
98
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 96

def app_impressions_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['impressionsTotal'], start_t, end_t, "DAY", view_by)
end

#app_in_app_purchasesObject

Sales / In-App Purchases



37
38
39
40
41
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 37

def app_in_app_purchases
  start_t, end_t = time_last_7_days

  app_in_app_purchases_interval(start_t, end_t)
end

#app_in_app_purchases_interval(start_t, end_t, view_by = nil) ⇒ Object



108
109
110
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 108

def app_in_app_purchases_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['iap'], start_t, end_t, "DAY", view_by)
end

#app_installsObject

Usage / Installations



58
59
60
61
62
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 58

def app_installs
  start_t, end_t = time_last_7_days

  app_installs_interval(start_t, end_t)
end

#app_installs_interval(start_t, end_t, view_by = nil) ⇒ Object



120
121
122
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 120

def app_installs_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['installs'], start_t, end_t, "DAY", view_by)
end

#app_measure_interval(start_t, end_t, measure, view_by = nil) ⇒ Object



92
93
94
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 92

def app_measure_interval(start_t, end_t, measure, view_by = nil)
  client.time_series_analytics([apple_id], [measure], start_t, end_t, "DAY", view_by)
end

#app_paying_usersObject

Sales / Paying Users



51
52
53
54
55
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 51

def app_paying_users
  start_t, end_t = time_last_7_days

  app_paying_users_interval(start_t, end_t)
end

#app_paying_users_interval(start_t, end_t, view_by = nil) ⇒ Object



116
117
118
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 116

def app_paying_users_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['payingUsers'], start_t, end_t, "DAY", view_by)
end

#app_salesObject

Sales / Sales



44
45
46
47
48
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 44

def app_sales
  start_t, end_t = time_last_7_days

  app_sales_interval(start_t, end_t)
end

#app_sales_interval(start_t, end_t, view_by = nil) ⇒ Object



112
113
114
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 112

def app_sales_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['sales'], start_t, end_t, "DAY", view_by)
end

#app_sessionsObject

Usage / Sessions



65
66
67
68
69
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 65

def app_sessions
  start_t, end_t = time_last_7_days

  app_sessions_interval(start_t, end_t)
end

#app_sessions_interval(start_t, end_t, view_by = nil) ⇒ Object



124
125
126
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 124

def app_sessions_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['sessions'], start_t, end_t, "DAY", view_by)
end

#app_unitsObject

Sales / App Units



30
31
32
33
34
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 30

def app_units
  start_t, end_t = time_last_7_days

  app_units_interval(start_t, end_t)
end

#app_units_interval(start_t, end_t, view_by = nil) ⇒ Object



100
101
102
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 100

def app_units_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['units'], start_t, end_t, "DAY", view_by)
end

#app_viewsObject

App Store / Product Page Views Unique Devices



23
24
25
26
27
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 23

def app_views
  start_t, end_t = time_last_7_days

  app_views_interval(start_t, end_t)
end

#app_views_interval(start_t, end_t, view_by = nil) ⇒ Object



104
105
106
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 104

def app_views_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['pageViewCount'], start_t, end_t, "DAY", view_by)
end

#time_last_30_daysObject



149
150
151
152
153
154
155
156
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 149

def time_last_30_days
  time = Time.now
  past = time - (60 * 60 * 24 * 30)
  end_t   = time.strftime("%Y-%m-%dT00:00:00Z")
  start_t = past.strftime("%Y-%m-%dT00:00:00Z")

  return start_t, end_t
end

#time_last_7_daysObject



140
141
142
143
144
145
146
147
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 140

def time_last_7_days
  time = Time.now
  past = time - (60 * 60 * 24 * 7)
  end_t   = time.strftime("%Y-%m-%dT00:00:00Z")
  start_t = past.strftime("%Y-%m-%dT00:00:00Z")

  return start_t, end_t
end

#time_last_90_daysObject



158
159
160
161
162
163
164
165
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 158

def time_last_90_days
  time = Time.now
  past = time - (60 * 60 * 24 * 90)
  end_t   = time.strftime("%Y-%m-%dT00:00:00Z")
  start_t = past.strftime("%Y-%m-%dT00:00:00Z")

  return start_t, end_t
end