Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Create an additional field named roistat, that will contain the visit number.

Configuring the script

1. Open your website server and find a file that processes the form of the lead. For example, this file may be a script that sends the data from the form to to e-mail. 

2. The data in this file must be in UTF-8 encoding.

3. Add the Roistat script to this file. The script will collect the data from the lead and send it to Roistat. On the basis of this data, Roistat will create a lead in CRM.

Example of the script:

Code Block
$roistatData = array(
    'roistat' => isset($_COOKIE['roistat_visit']) ? $_COOKIE['roistat_visit'] : 'nocookie',
    'key'     => 'value', //value is the integration key from your Roistat project
    'phone'   => 'value', //value is the client's phone number or variable that receives this number
	'email'   => 'value', //value is the client's email or variable that receives this email
    'fields'  => array(), //array that can be filled to receive the values of additional fields or can be left empty
file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));

(warning) Client's phone number and email are mandatory fields. You have to transmit at least one of them, or lead will not be created.

Integration key must also be entered. Without integration key, the upload of leads will not work. You can find the integration key in your Integration catalog:

Image Modified

Additional settings

These settings are useful, but not necessary. If you want only to transmit the standard fields of the lead to CRM and dont need to configure the callback and verification of incoming leads for duplicate, go to configuration testing phase. 


If a client left his phone number in the form of the lead, you can automatically call him back. To do it, you need to activate the callback in the Lead Hunter settings and specify your manager's phone number for callback.

Transmission of additional fields

You can create the additional fields of leads in your CRM and automatically fill them using the Roistat service when a lead is created using the website form. For example, you can appoint a responsible manager by transmitting his ID to the field in CRM. 

The formats and names of additional fields in each CRM are different. To transmit their value, you have to know their ID. If you don't know the ID of these fields, contact your CRM customer service. 

Many CRM's have API. With the help of API-method, you can upload your leads and check out their fields and ID of these fields. 

The usage of variables

You can use the variables to transmit the value of the visit to some fields of the lead. For example, you can transmit the name of the city to the additional field in CRM from which the client visited your website and made a lead.

You can use the variables in the following fields of the leads: 

  • title
  • comment
  • name
  • additional fields
titleWhich variables you can use



{city}City name
{visit}Visit number
{referrer}Referrer page
{landingPage}Landing page
{source}Source (marker)
{utmSource}utm_source tag value
{utmMedium}utm_medium tag value
{utmCampaign}utm_campaign tag value
{utmTerm}utm_term tag value
{utmContent}utm_content tag value
{callee}dialed number


roistat_param1 tag value
{roistatParam2}roistat_param2 tag value
{roistatParam3}roistat_param3 tag value
{roistatParam4}roistat_param4 tag value
{roistatParam5}roistat_param5 tag value

titleПример использования переменныхExample of using the variables

Code Block
$roistatData = array( 
	'title' => 'New deal {visit}', //Add the visit number to the title of the deal
	'name' => 'Client's name {visit}', //Add the visit number to the client's name
	'comment' => 'utm_source: {utmSource}, utm_medium: {utmMedium}, utm_campaign: {utmCampaign}', //Transmit the utm-tags to the comment of the deal 
	'fields' => array( 
		'1276733' => '{city}', // Save the city of the visitor in the additional field 1276733
		'tags' => 'Тег1, {utmSource}, {utmMedium}, {utmCampaign}', // Save the values of utm-tags in tags
file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));


Use the 'sync' => '1'  parameter when after the sending of lead from website to Roistat you need to receive the approval of deal creation from CRM. If the deal is created successfully, the script will return its ID. It may be useful to show a client the number of order after the creation of the deal. If the deal cannot be created, you will see the error message instead of ID. 

titleПример использованияExample of using

Code Block
$roistatData = array(
    'roistat' => isset($_COOKIE['roistat_visit']) ? $_COOKIE['roistat_visit'] : 'nocookie',
	'key'     => 'SECRET_KEY'
    'title'   => 'Title of the deal',
    'name'    => 'Client's',
    'phone'   => '11231234567',
	'sync' => '1',


(информация) You can export the list of the lead to Excel. To do it, select the period and click the Download button:


Solution to the problems

titleLead from the website does not exist in Sent leads

It means that the lead is not sent from the website to Roistat or cannot be received by Roistat. Possible causes: 

  1. Problems with your website server.
  2. Error in the script. 

How to solve:

  1. Change the last line of the script from this:
    file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));

    to this:

    file_get_contents("http://cloud-reserved.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));

    Save the changes and try to create the lead on the website once again. If it does not appear in the Sent leads, ask your provider why the data is not sent to the following addresses: https://cloud.roistat.com/api/proxy/1.0/leads/add;

  2. Check out the script for errors with the help of code checker