Include location in user analytics
This commit is contained in:
parent
3de6b4a646
commit
5965929187
3 changed files with 11 additions and 5 deletions
|
@ -381,6 +381,7 @@ class User(ApiResource):
|
|||
user_data.get('given_name'),
|
||||
user_data.get('family_name'),
|
||||
user_data.get('company'),
|
||||
user_data.get('location'),
|
||||
)
|
||||
ua_mdata_future.add_done_callback(build_error_callback('Change metadata failed'))
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ def common_login(user_uuid, permanent_session=True):
|
|||
user.given_name,
|
||||
user.family_name,
|
||||
user.company,
|
||||
user.location,
|
||||
)
|
||||
create_lead_future.add_done_callback(build_error_callback('Create lead failed'))
|
||||
return True
|
||||
|
|
|
@ -39,7 +39,7 @@ class _MarketoAnalyticsClient(object):
|
|||
self._munchkin_private_key = munchkin_private_key
|
||||
self._lead_source = lead_source
|
||||
|
||||
def _get_lead_metadata(self, given_name, family_name, company):
|
||||
def _get_lead_metadata(self, given_name, family_name, company, location):
|
||||
metadata = {}
|
||||
if given_name:
|
||||
metadata['firstName'] = given_name
|
||||
|
@ -50,9 +50,12 @@ class _MarketoAnalyticsClient(object):
|
|||
if company:
|
||||
metadata['company'] = company
|
||||
|
||||
if location:
|
||||
metadata['location'] = location
|
||||
|
||||
return metadata
|
||||
|
||||
def create_lead(self, email, username, given_name, family_name, company):
|
||||
def create_lead(self, email, username, given_name, family_name, company, location):
|
||||
lead_data = dict(
|
||||
email=email,
|
||||
Quay_Username__c=username,
|
||||
|
@ -60,7 +63,8 @@ class _MarketoAnalyticsClient(object):
|
|||
Lead_Source_Detail__c=self._lead_source,
|
||||
)
|
||||
|
||||
lead_data.update(self._get_lead_metadata(given_name, family_name, company))
|
||||
lead_data.update(self._get_lead_metadata(given_name, family_name,
|
||||
company, location))
|
||||
|
||||
self._marketo.create_update_leads(
|
||||
action='createOrUpdate',
|
||||
|
@ -93,8 +97,8 @@ class _MarketoAnalyticsClient(object):
|
|||
lookupField='id',
|
||||
)
|
||||
|
||||
def change_metadata(self, email, given_name, family_name, company):
|
||||
lead_data = self._get_lead_metadata(given_name, family_name, company)
|
||||
def change_metadata(self, email, given_name, family_name, company, location):
|
||||
lead_data = self._get_lead_metadata(given_name, family_name, company, location)
|
||||
if not lead_data:
|
||||
return
|
||||
|
||||
|
|
Reference in a new issue