def send_group(self, user_id, du_account_url): try: if self.is_enabled: analytics.group(user_id, strip_account_url(du_account_url), traits={ 'ddu_url_': 'DU', 'account_url_': strip_account_url(du_account_url), 'cli_last_executed_at': datetime.datetime.now().isoformat() }, anonymous_id=self.anonymous_id) except Exception as except_err: logger.error( "Exception in send_group while communicating to segment") logger.exception(except_err)
def group(): try: content = request.get_json(silent=True) _userId = content.get('userId') _groupId = content.get('groupId') _traits = content.get('traits') _context = content.get('context') _timestamp = format_timestamp(content.get('timestamp')) _anonymous_id = content.get('anonymousId') _integrations = content.get('integrations') analytics.flush() analytics.group(_userId, _groupId, _traits, _context, _timestamp, _anonymous_id, _integrations) return format_response('group') except Exception as e: return json.dumps({'error': str(e)})
def test_group(self): analytics.group('userId', 'groupId') analytics.flush()
analytics.identify(random_user, userTraits, context={"externalIds": userExternalIds}, anonymous_id=anonId) groupProps = False if sendGroupCall: userGroup = random.choice(companyData) groupProps = { 'company_id': userGroup[0], 'company_name': userGroup[1], 'industry': userGroup[2], "client_ARR": random.randint(0, 500000), "client_DAU": random.randint(0, 50) } analytics.group(random_user, userGroup[0], groupProps) hospitalityOwnerships = [] if industry == "wyndham": hospitalityMembershipId = random.randint(1111, 9999) hospitalityMembershipName = userName.split(' ')[1] + '-' + str( hospitalityMembershipId) analytics.group(random_user, hospitalityMembershipId, {"name": hospitalityMembershipName}) analytics.group(random_user, "121", {"name": "Reinhardt-121"}) # hospitalityOwnerships = [] for i in xrange(0, random.randint(2, 8)): ownershipLocation = random.choice( eventData[industry]["strings"]["location"]) ownershipNightlyPrice = random.randint(100, 3000)
def group(): analytics.group(options.userId, options.groupId, json_hash(options.traits), json_hash(options.context), anonymous_id=options.anonymousId)
def test_group(self): analytics.group('distinct_id', 'groupId') analytics.flush()
properties = arguments["--properties"] if properties: properties = json.loads(properties) analytics.track(user_id = userId, anonymous_id=anonymousId, event = arguments["--event"], properties = properties, context = context, integrations = integrations) elif msgType == "screen": properties = arguments["--properties"] if properties: properties = json.loads(properties) analytics.screen(user_id = userId, anonymous_id=anonymousId, name = arguments["--name"], properties = properties, context = context, integrations = integrations) elif msgType == "page": properties = arguments["--properties"] if properties: properties = json.loads(properties) analytics.page(user_id = userId, anonymous_id=anonymousId, name = arguments["--name"], properties = properties, context = context, integrations = integrations) elif msgType == "alias": analytics.alias(user_id = userId, previousId=arguments["--previousId"]) elif msgType == "group": traits = arguments["--traits"] if traits: traits = json.loads(traits) analytics.group(user_id = userId, anonymous_id=anonymousId, group_id = arguments["--groupId"], traits = traits, context = context, integrations = integrations) elif msgType == "identify": traits = arguments["--traits"] if traits: traits = json.loads(traits) analytics.identify(user_id = userId, anonymous_id=anonymousId, traits = traits, context = context, integrations = integrations) else: raise Exception('Unknown argument') analytics.flush
def group(): analytics.group(options.userId, options.groupId, json_hash(options.traits), json_hash(options.context), anonymous_id = options.anonymousId)