Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update sdk version from 2.4 to 2.5

...

Code Block
languagejs
linenumberstrue
<!-- Treasure Data -->
<script type="text/javascript">
 !function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}},s=["addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],n=0;n<s.length;n++){var c=s[n];e[t].prototype[c]=r(c)}var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.treasuredata.com/sdk/2.45/td.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)}}("Treasure",this);
</script>
<script>
  var td = new Treasure({...})
  
  var successCallback = function (values) {
    /* values format => [... {
      key: {
        [key]:value
      },
      values: ["1234"],
      attributes: {
        age: 30
      },
  
    } ... ]*/
    // celebrate();
  };
  
  var errorCallback = function (error) {
    // cry();
  };
  
  td.fetchUserSegments({
    audienceToken: ['YOUR_PROFILES_API_TOKEN_1', 'YOUR_PROFILES_API_TOKEN_2'],
    keys: {
      someKey: 'someValue',
      someOtherKey: 'someOtherValue',
    }
  }, successCallback, errorCallback)
</script>Example Profile Output

...