If you use Segment to track and send your users and accounts to other tools, Vitally provides a 'shortcut' way to reuse your Segment logic alongside our NPS Javascript. 

To do so, you still need to follow most of the steps described here. However, do not worry about identifying the user and account via the Vitally.user and Vitally.account APIs. Instead, when calling Vitally.nps('survey'), in the second argument that supports additional options, specify an autoLoadSegment option and set to true

Vitally.nps('survey', {
  productName: 'Pied Piper', 
  autoLoadSegment: true,
  delay: 1000
});

Doing this will listen for calls to Segment's analytics.identify and analytics.group APIs. When detected, the NPS survey will automatically use the user and account tracked via Segment.

Putting this all together, an entire example snippet to add to your HTML that uses Segment's user and account would look something like this:

<script type="text/javascript" src="https://cdn.vitally.io/vitally.js/v1/vitally.js" defer></script>
<script type="text/javascript">
  !function(n,t,r){for(var i=n[t]=n[t]||[],o=function(r){i[r]=i[r]||function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return i.push([r,n])}},u=0,c=["init","user","account","track","nps"];u<c.length;u++){o(c[u])}}(window,"Vitally");
  Vitally.init('YOUR_TOKEN_HERE');
  Vitally.nps('survey', {
    productName: 'Pied Piper', 
    autoLoadSegment: true,
    delay: 1000
  });
</script>