File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright 2018 Google Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from firebase_admin import dynamic_links
16
+
17
+
18
+ def get_link_stats ():
19
+ # [START get_link_stats]
20
+ stat_options = dynamic_links .StatOptions (last_n_days = 7 )
21
+ stats = dynamic_links .get_link_stats ('https://abc.app.goo.gl/abc12' , stat_options )
22
+ # arrange the list results in a dict
23
+ results = dict ()
24
+ for stat in stats .event_stats :
25
+ results [(stat .platform , stat .event_type )] = stat .count
26
+
27
+ ios_first_installs = results .get ([(dynamic_links .PLATFORM_IOS ,
28
+ dynamic_links .EVENT_TYPE_APP_FIRST_OPEN )])
29
+
30
+ if ios_first_installs :
31
+ print ('There were {} first install on IOS in the last 7 days' .format (ios_first_installs ))
32
+ # [END get_link_stats]
You can’t perform that action at this time.
0 commit comments