Loading...
Page tree
Skip to end of metadata
Go to start of metadata

There are two ways of sending the leads to CRM: 

  • In the first case, data is transferred from a website to CRM and then is uploaded to Roistat. Read more at Upload of leads to CRM
  • In the second case, data is transferred to Roistat and then is sent to CRM. This way has the following advantages:
    • It provides the backup of information about the leads in Roistat. 
    • It allows quickly to change the configuration of transfer of leads to CRM.  

Configuration

To start the configuration, integrate your CRM with Roistat (read the integration manual for your CRM).

The transfer of leads to CRM can be configured in two ways:

  1. In Roistat interface (the easiest way).   
  2. With the help of PHP-code (this way is the most flexible in configuration).

How to configure the transfer of leads to CRM using the Roistat interface

(warning) This way is unavailable if the code of the form is placed between <iframe></iframe> tags.

  1. Open the Settings of your Roistat project and choose the Leads from the website forms tab.  
  2. Click the Add form button.   
    You will see the New form window.
  3. In the Name field, specify the name of the form that will be sent to the lead's title. Leads created through this form will be called Lead from the Form name form
  4. Specify the mechanism of sending the data on the lead:

    • Form. Use this mechanism if the leads' forms in the source code of your website are tagged by < form > tag, form fields are tagged by < input > tag, and data is sent by reloading the webpage or by pressing the button with type="submit" type.
    • Button. Use this mechanism if the data from the lead's form is sent with the help of AJAX by clicking any type of button. 
  5. After choosing the mechanism of sending the data on the lead, specify For selector or Button selector
    • Form selector is a CSS-selector that verifies the website form, from which Roistat receives the data for forming the lead. No matter how many selectors you specify, one or several, but It is important that these selectors verify the needed form. To specify the selectors, use CSS-notation, for example class selector .registration-form-1 (<form class=“registration-form-1”>), identifier selector #contact-form-1 (<form id=“contact-form-1”>).  
    • Button selector is a CSS-selector that verifies the website button, by clicking on which Roistat receives the data for forming the lead. No matter how many selectors you specify, one or several, but It is important that these selectors verify the needed form. To specify the selectors, use CSS-notation, for example class selector .bnt-primary (<button class=“bnt-primary”>).   

       How to get the CSS-selector of form or button
      1. Open the order form on your website. Usually, it is called Shopping cart. If the data of the order is entered directly on your website page, open the page where you can create the order. 
      2. Open the source code of the order form or order page. You can do it with the help of your browser by selecting the content of the form or content of the order page and clicking the Source code of the selected fragment button. 
      3. Search by the keyword form id or form, if you want to get the CSS-selector of form or search by the name of the button from which the order is sent if you want to get the CSS-selector of button. 
      4. Copy the identifier value (id) or class value (class):
  6. Specify the way of filling the main fields of the form in CRM:
    Static value:

    In this case, the value entered in the right field is transferred to the lead in CRM without any changes. Click here to see the list of variables you can use to fill the main fields. 

    Value from the form field:

    In this case, the value entered in the form field on the website is transferred to the lead in CRM. For example, if you see <input type="text" name="Phone"...> in the code of the form on your website, you must enter Phone in the phone field. can specify the value of the name attribute by Укажите значение атрибута nameдля поля формы на сайте. 

    Result of JS execution:

    In this case, the value received with the help of JS-code is transferred to the lead in CRM. For example, value return $("input[name='email']").val() is transferred to Email field.

  7. If needed, create additional fields of the lead:
    (информация) You can't add the additional fields if integration with goals is configured in Roistat project. 
    1. Open the Additional fields block.
    2. Select the required field from the dropdown list. The list is uploaded from the integrated CRM.  
    3. Specify the way of filling the additional field (see paragraph 6 of this manual).
      (информация) If you need to transfer the empty value to the additional field of the lead, specify the Static value and press space bar. 
    4. Click the Add button. Добавить и повторите пункты b и c, если требуется больше одного дополнительного поля.
    You can use the Additional fields to specify the city in which the lead was created or to fill in the mandatory CRM field that is absent in the form. 
  8. Click the Save button. 

The information about the created form will appear in the Leads from the website form page. To edit or delete the form, use the buttons in the Actions section:

(информация) Changes will take effect within several minutes, as well as in the issuance of a new visit number. 

How to configure the transfer of leads to CRM via Roistat with the help of the code

Here's the example of PHP-code, that collects the data from lead's form and sends this data to Roistat. Use this code as a basis, edit it, and add it to the file that processes the forms on your website:

Code for configuring the transfer of leads to CRM via Roistat
<?php
// All data must be in UTF-8.
// If you use Windows-1251 encoding, you can convert all the variables using $value = iconv("Windows-1251", "UTF-8", $value);
// or specify the 'charset' key in the additional fields with the encoding used on your website. Roistat server will convert all the values with specified encoding to UTF-8.
 
// ...
// Here you can call the current function for creating the deal, for example mail() function.
// ...
 
$roistatData = array(
    'roistat' => isset($_COOKIE['roistat_visit']) ? $_COOKIE['roistat_visit'] : 'nocookie',
    'key'     => '', // Key for integration with CRM that is specified in the CRM integratiom settings.
    'title'   => '', // Name of the deal
    'comment' => '', // Comment to the deal
    'name'    => '', // Name of the client
    'email'   => '', // Email of the client
    'phone'   => '', // Client's phone number
	'order_creation_method' => '', // The way of deal creation (optional parameter). Specify the value that will be shown in "The way of deal creation" section of Analytics
	'is_need_callback' => '0', // After creating the lead in Roistat, Roistat initiates a callback to the client's number if the value of this parameter is '1' and Lead hunter has activated callback indicator.
	'callback_phone' => '<number for redefinition>', // Redefines the number specified in the callback settings.
    'sync'    => '0', //  
    'is_need_check_order_in_processing' => '1', // Activating the verification of incoming requests for duplicates
	'is_need_check_order_in_processing_append' => '1', // If the duplicate is created, it will receive a comment
	'fields'  => array(
	// Array of additional fields. If you don't need to add the additional fields, leave this array empty.
	// See the examples of additional fields in the table below.
     "charset" => "Windows-1251", // Server converts the value of fields with the specified encoding to UTF-8.
    ),
);
 
file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));
?>


How to use the API-method to add a comment to the deal
<?php
// Method adds the comment to the deal
$roistatData = array(
    'key'     => '', // Key for integration with CRM that is specified in the CRM integration settings.
    'id'   => '', // Lead identifier that returns it after the creation of method /api/proxy/1.0/leads/add)
    'title'    => '', // Title of comment (optional)
    'message' => '', // Comment to the deal
    ),
);
   
file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/messages/add?" . http_build_query($roistatData));
?> 
 How to use the 'sync' parameter

By default, the value of the sync parameter is 0 ( 'sync' => '0').

In this case, transfer of leads works the following way:

  1. Data about the lead is sent to Roistat.
  2. Roistat sends you a report about receiving the data.
  3. Roistat sends information about the lead to CRM.
  4. The ID of the lead that was created in CRM is sent to Roistat.
  5. If the lead cannot be created, its ID cannot be transferred to CRM. In this case, there will be no error message. 

Set the value of the sync parameter to 1 ( 'sync' => '1'), and transfer of leads will work the following way: 

  1. Data about the lead is sent to Roistat.
  2. Roistat sends you a report about receiving the data.
  3. Roistat sends information about the lead to CRM.
  4. If the lead cannot be created, the error message will appear.
  5. If the lead was created, its ID will be sent to Roistat.

(warning) If the value of the sync parameter is 1, the error message or ID of the lead will also be sent in response to the request of proxylead creation. 

 Hot to get the 'key' parameter

To configure the integration, you need to copy the value of the 'key' parameter (integration key) from the Integrations catalog. To enter the Integrations catalog, open the Integrations list and select your CRM integration:

 Additional fields of 'fields' => array(). They are needed to set the values of additional fields in CRM
CRMAdditional fields
Salesforce

// To fill in the additional field, you must transfer it in the following format: key => value. If you want to fill in the custom field, use the API name as key. If you want to fill in the standard field, use the Field name as key.
'Company' => 'Company name' ,
'Title' => 'Position' ,
'Owner' => 123, // Responsible manager, where 123 is manager's ID.

// Read Salesforce user documentation to learn more about custom fields: https://help.salesforce.com/articleView?id=customize_customfields.htm&type=5

amoCRM
'price' => 123, // 'Budget' field in amoCRM.
'responsible_user_id' => 3, // Id of a manager who is responsible for deal.
'1276733' => 'Text', // Filling in the additional field with ID 1276733. You can fill in the additional field of a deal and additional field of a contact.
In case of filling the additional field of a contact, specify the ID of this field.
'status_id' => 123123, // Create a lead with specific status in specific pipeline. You must speficy the status ID. 
'pipeline_id'
=> 123123, // Create a lead in specific pipeline. You must specify the pipeline ID.
// You can get more information about additional fields list in amoCRM user documentation: https://www.amocrm.com/developers/content/platform/abilities/#lead.
// To get more information about operating with amoCRM additional fields, contact Roistat support.
'tags' => 'Tag1, Tag2', // Specify the tags titles using a comma.

List of variables

ПеременнаяЗначение
{city}Visitor's city
{country}

Visitor's country

{region}

Visitor's region

{ip}

Visitor's IP

{phone}Visitor's phone number
{name}Visitor's name
{email}Visitor's email address
{visit}Visit number
{firstVisit}First visit number
{referrer}Referrer page 
{domain}Webaite domain
{landingPage}Ladning page
{source}Source (marker)
{orderCreationMethod}Lead creation method (Calltracking, Lead hunter, etc)
{utmSource}The value of visitor's tag 'utm_source'
{utmMedium}The value of visitor's tag 'utm_medium' 
{utmCampaign}The value of visitor's tag 'utm_campaign'
{utmTerm}The value of visitor's tag 'utm_term' 
{utmContent}The value of visitor's tag 'utm_content'
{callee}Dialed number (if leads are created by calltracking)
{caller}Client's phone number (if leads are created by calltracking)

{roistatParam1}

The value of visitor's tag 'roistat_param1'
{roistatParam2}The value of visitor's tag 'roistat_param2'
{roistatParam3}The value of visitor's tag 'roistat_param3'
{roistatParam4}The value of visitor's tag 'roistat_param4'
{roistatParam5}The value of visitor's tag 'roistat_param5'
{googleClientId}ClientId value from Google Analytics
{sourceLevel1}The value of level 1 source (marker) 
{sourceLevel2}The value of level 2 source (marker) 
{sourceLevel3}The value of level 3 source (marker) 
{sourceLevel4}The value of level 4 source (marker) 
{sourceLevel5}The value of level 5 source (marker) 
{sourceLevel6}The value of level 6 source (marker) 
{sourceLevel7}The value of level 7 source (marker) 
{sourceAliasLevel1}Readable title of level 1 source (marker)
{sourceAliasLevel2}Readable title of level 2 source (marker)
{sourceAliasLevel3}Readable title of level 3 source (marker)
{sourceAliasLevel4}Readable title of level 4 source (marker)
{sourceAliasLevel5}Readable title of level 5 source (marker)
{sourceAliasLevel6}Readable title of level 6 source (marker)
{sourceAliasLevel7}Readable title of level 7 source (marker)
The example of using the variables
$roistatData = array(
	'title'   => 'New deal {visit}',
	'name'    => 'Client's name {visit}',
	'comment' => 'utm_source: {utmSource}, utm_medium: {utmMedium}, utm_campaign: {utmCampaign}',
	'fields'  => array(
		'1276733' => '{city}', // Save the visitor's city in the additional field
		'tags'    => 'Тег1, {utmSource}, {utmMedium}, {utmCampaign}', // Save the value of UTM-tags in tags
	),
);

How does the lead transfer work

  1. Customer visits your website and creates a lead.
  2. Lead is created in the Roistat project. You cant inspect the newly created lead by clicking the Sent leads button in your CRM Integrations catalog
  3. Roistat verifies if your CRM is integrated into Roistat and if the lead transfer is configured in your CRM.
    • If your CRM is not integrated or lead transfer is not configured, the deal will not be created.  

(warning) If CRM does not send the approve of lead creation, you will see the  icon in the Sent field of Sent leads list. After that, Roistat will attempt to send this lead every 30 minutes for 2 days. After receiving the approve from CRM, you will see the   icon in the Sent field, and the number of the deal will be shown in the Deal field. 

Transfer of the unsent leads to Roistat

Every 2 hours Roistat will attempt to send the unsent leads created within the last 48 hours.

  • No labels