You can add known ids of visitors with Treasure Data SDKs.
Basic knowledge of JavaScript and HTML
Basic knowledge of Treasure Data
Basic knowledge of Treasure Data JavaScript SDK
To add known IDs of visitors (most commonly, email, user_id, etc):
td.set() function can be used to add an arbitrary number of additional information for the visitors.
<script type="text/javascript">
// Configure an instance for your database
var td = new Treasure({...});
// Enable cross-domain tracking
td.set('$global', 'td_global_id', 'td_global_id');
// Add Known IDs to tracking information
td.set('pageviews', {
email: 'kazuki@treasure-data.com',
account_id: '1024'
});
// Track pageview information to 'pageviews' table
td.trackPageview('pageviews');
</script>As Treasure Data is schema-less architecture, you can add and subtract any number of known ID columns anytime.
You might want to send raw known IDs to Treasure Data. CryptoJS supports the majority of encryption algorithms including SHA-256, AES, etc.:
Apply encryption with CryptoJS, before sending IDs to Treasure Data.
<!-- Load CryptoJS library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
<script type="text/javascript">
....
// Add Known IDs to tracking information
td.set('pageviews', {
email: CryptoJS.enc.Base64.stringify(CryptoJS.SHA256('meg@tre-data.com')),
account_id: CryptoJS.enc.Base64.stringify(CryptoJS.AES.encrypt('1024', 'secret key 1234').ciphertext)
});
....
</script>