forked from PokemonGoF/PokemonGo-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Anonymous login succ/failed/relogin/logout info to GA. (PokemonGoF#1312)
* There's a big warning before bot login and 2s wait for exit if the health report is turned on. Anonymous login succ/failed/relogin/logout info without any user account info will be sent to GA. The function is not called to wait Signal system merge. * Fixed page view is not true. * Removed [x] since we ditched it.
- Loading branch information
Showing
6 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from bot_event import BotEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
from UniversalAnalytics import Tracker | ||
from pokemongo_bot import logger | ||
from time import sleep | ||
|
||
class BotEvent(object): | ||
def __init__(self,bot): | ||
self.bot = bot | ||
# UniversalAnalytics can be reviewed here: | ||
# https://github.com/analytics-pros/universal-analytics-python | ||
# For central TensorFlow training, forbiden any personally information | ||
# report to server | ||
# Review Very Carefully for the following line, forbiden ID changed PR: | ||
if bot.config.health_record: | ||
logger.log('Send anonymous bot health report to server, it can be disabled by config \"health_record\":false in config file', 'red') | ||
logger.log('Wait for 2 seconds ', 'red') | ||
sleep(3) | ||
self.tracker = Tracker.create('UA-81469507-1', use_post=True) | ||
# No RAW send function to be added here, to keep everything clean | ||
def login_success(self): | ||
if self.bot.config.health_record: | ||
self.tracker.send('pageview', '/loggedin', title='succ') | ||
def login_failed(self): | ||
if self.bot.config.health_record: | ||
self.tracker.send('pageview', '/login', title='fail') | ||
def login_retry(self): | ||
if self.bot.config.health_record: | ||
self.tracker.send('pageview', '/relogin', title='relogin') | ||
def logout(self): | ||
if self.bot.config.health_record: | ||
self.tracker.send('pageview', '/logout', title='logout') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ enum34==1.1.6 | |
pyyaml==3.11 | ||
haversine==0.4.5 | ||
polyline==1.3.1 | ||
universal-analytics-python==0.2.4 |