Skip to content

Instantly share code, notes, and snippets.

@totango
Created February 19, 2012 15:15
Show Gist options
  • Save totango/1864239 to your computer and use it in GitHub Desktop.
Save totango/1864239 to your computer and use it in GitHub Desktop.
Totango - Javascript - updating account attributes
// identifying an account and setting attributes for it
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// totango.identify(account, user);
// params:
// - account: the account the user belongs to. possible values:
// - string: value is the account id
// - object:
// { 'o': 'account-id',
// 'attribute-name' : 'attribute-value', }
// - username: Name of the user of this session
totango.identify(
{'id':'acme1234',
'Sales Manager':'Evon Barksdale',
'Source Campaign':'Adwords12345',
'Region':'Baltimore'
},
'username');
// You can also use setAccountAttributes(). This will have the following affect:
// If the session already was identified() setAccountsAttributes() will immediately associate the attribute & value
// with the identified account.
// If the session was not identified, setAccountAttributes() will temporarily store the data using session cookies.
// Once the identity of the session is set, all previously set attributes will be associated with the account
// -------------------------------------------------------------------------------------------------
// totango.setAccountAttributes(account_attributes, user_attributes);
// params:
// - account_attributes: object containing list of account attributes to set
// - user_attributes: currently reserved and not used
totango.setAccountAttributes({'Source Campaign':'12345'});
// ....
// ....
// later, when identify is called, the attributes previously set on the session will be flushed into the account
totango.identify('acme1234','user1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment