Skip to content

Integration with YCLIENTS

Please note:

The integration of Roistat with YCLIENTS works with records and contacts.

Step 1. Step 1. Install the Roistat Tracking Code

Install the Roistat tracking code on every page of your website that is visited by your customers. The tracking code is needed to receive information about the visits. To learn more about the tracking code installation, read this article.

Change the code of the YCLIENTS form

Find the following code of YCLIENTS:

<script type="text/javascript" src="https://wXXXXX.yclients.com/widgetJS" charset="UTF-8"></script>

where wXXXXX - is your form ID.

Change it to the following code:

<script>
window.roistatVisitCallback = function(visitId) {
document.cookie = 'yextrafield_roistat=' + visitId;
var script = document.createElement('script');
script.src = "https://wXXXXX.yclients.com/widgetJS";
document.getElementsByTagName('body')[0].appendChild(script);
};
</script>

Insert your form ID instead of wXXXXX.

Step 2. Add the Additional Field "roistat"

To add the additional field, login to YCLIENTS and open Analytics → Integration with Roistat.

Please note:

  • The additional field should be named roistat, otherwise, the integration won't work.
  • If you create a lead manually, you can fill in the roistat field with the data of the source of the lead. The information about the source of the lead will be displayed in Analytics.

To bind the lead to the specified marketing channel, enter the following markers in the roistat field:

  • google{ID}, if you want to bind the deal to the Google Adwords channel. For example, google3.
  • merchant{ID}, if you want to bind the deal to the Google Merchant Center channel. For example, merchant4.
  • facebook{ID}, if you want to bind the deal to the Facebook channel. For example, facebook6.
  • seo_google, if you want to bind the deal to the SEO - Google channel.

Step 3. Connect the YCLIENTS in the Integrations List

  1. Open the Integrations section and click Add integration.

  2. Select YCLIENTS and click Set up integration.

  3. Fill in the authorization fields of YCLIENTS:

    • Enter the email address or telephone number of your account in the Login field. The number should be entered in the following format: 1xxxxxxxxxx.
    • Enter your account password in the Login field.

    Please note:

    Make sure that this user is added in the configurations of the main net and has admin access. How to verify if the user is added to the configurations of main net:

    1. Determine the main network of the branch. To do it, open the interface of the branch and open Settings → Networks.
    2. Go to the settings of the main network and open Settings → Users. Verify if the user is added to the network configuration and has the full access rights. If you cannot select the network in the interface, contact the administrator of this network.
  4. Click the Save button. Statuses of the deals from YCLIENTS will be loaded.

  5. Distribute the statuses of the deals by dragging them into the statuses groups.

  6. Click the Continue button.

  7. Specify the parameters for the additional configuration:

    1. Specify the parameters of the filtration of deals.
    2. Specify the values of business indicators.
    3. Click the Save button.
  8. Select your managers in the Deals responsible managers field and the company of your responsible managers in the Company of the responsible managers field.

  9. Click the Save button.

  10. Go to YCLIENTS and open Online-record → Website → Script injection.

  11. Enter the following code into the HTML code field:

    <script>
    (function(w, d, s, h, id) {
       w.roistatProjectId = id; w.roistatHost = h;
       var p = d.location.protocol == "https:" ? "https://" : "http://";
       var u = /^.*roistat_visit=[^;]+(.*)?$/.test(d.cookie) ? "/dist/module.js" : "/api/site/1.0/"+id+"/init";
       var js = d.createElement(s); js.charset="UTF-8"; js.async = 1; js.src = p+h+u; var js2 = d.getElementsByTagName(s)[0]; js2.parentNode.insertBefore(js, js2);
    })(window, document, 'script', 'cloud.roistat.com', 'tracking code key');
    </script>
    <script>
       window.onRoistatModuleLoaded = function () {
           var params = window
           .location
           .search
           .replace('?','')
           .split('&')
           .reduce(
               function(p,e){
                   var a = e.split('=');
                   p[ decodeURIComponent(a[0])] = decodeURIComponent(a[1]);
                   return p;
               },
               {}
           );
           if (params['yextrafield_roistat']) {
               window.roistat.setVisit(params['yextrafield_roistat']);
           }
       };
    
    window.roistatVisitCallback = function (visitId) {
          console.log('visitId', visitId);
    
    window.yclientsAdditionalOptions = {
                bookingCustomFields: {
                    roistat: visitId
                }
            };
        };
    </script>
    

    and enter the roistat tracking code key instead of 'tracking code field' using the ' ' brackets.

  12. Click the Save button.

Step 4. Configure the Automatic Transfer of Deals in YCLIENTS

If you use the third-party forms (besides of YCLIENTS widget), we recommend you to configure the transmission of leads to CRM via Roistat. Read more in this article.

If the transmission of deals from website to CRM is already configured with the help of your code, fill in the additional field roistat with the browser cookie roistat_visit.

Here is the code you can use to receive the value of this cookie:

$roistatVisitId = array_key_exists('roistat_visit', $_COOKIE) ? $_COOKIE['roistat_visit'] : "unknown";

Verifying the Performance

  1. Create the lead on the website.
  2. Go to the Project diagnosticsList of submitted leads section and find the lead you created.
  3. Check if the visit number is specified in the Promo code field.
  4. Find the successful status of the lead in the Sent field.
  5. Find the new lead with the visit number in your CRM.