# New vs. returning visitors

QL's SDK lets you segment your conversions into purchases made by new users and purchases made by returning users.

If you choose to tell us whether a purchase was made by a new or a returning visitor, we'll be able to display this information visually in various parts of our UI, and provide you with an additional dimension on which to analyze your store traffic and revenue stream.

This feature is optional, and you are under no obligation to use it.

If you choose to segment your conversions into new and existing users, please invoke the sendConfirmationEvent SDK with a third boolean parameter that indicates whether the purchase was made by a new user (pass true) or by ane existing user (pass false).

# Integration example

The integration example below is based on the basic server-side SDK integration example. Please modify to suit your requirements (for example GTM).

# New user

<script>
  window.QLAsync = function(QL){
    var clientKey = '<%= $clientKey %>',
        productId = '<%= $productId %>',
        salePrice = '<%= $salePrice %>';
    QL.init(clientKey);
    // NOTE THE CHANGE ON THE LINE BELOW - true is passed as a third argument
    QL.sendConfirmationEvent(productId, parseFloat(salePrice, 10), true);
  }
</script>
<script src="//d3jdlwnuo8nsnr.cloudfront.net/sdk/v2.1/ql.js"></script>

Please Note

QL.sendConfirmationEvent receives a third boolean parameter that indicates the purchase was made by a new user (true)

# Existing user

<script>
  window.QLAsync = function(QL){
    var clientKey = '<%= $clientKey %>',
        productId = '<%= $productId %>',
        salePrice = '<%= $salePrice %>';
    QL.init(clientKey);
    // NOTE THE CHANGE ON THE LINE BELOW - false is passed as a third argument
    QL.sendConfirmationEvent(productId, parseFloat(salePrice, 10), false);
  }
</script>
<script src="//d3jdlwnuo8nsnr.cloudfront.net/sdk/v2.1/ql.js"></script>

Please Note

QL.sendConfirmationEvent receives a third boolean parameter that indicates the purchase was made by an existing user user (false)