How to install RTLS

After you contacted our commercial support, you will be given an API key and a Session Recording token. This API key and Session Recording token are mandatory to install RTLS on any landing page.

If you are not comfortable with installing RTLS scripts by yourself, you could as well provide us with your landing page and we will install it for you(6)

First, insert the following script just before </body>

<!-- RTLS / Start -->
<!--
For better performance, insert this script right before the end of the body (e.g. before </body>)
You should not call for jQuery if already called somewhere else into the webpage as it might troubleshoot your design

!important: Always call for jQuery add-ons. If not called, tracking will not work
!important: Set up lpm_aid with your API token provided by commercial support
!important: Set up lpm_formId with the same form ID attribute (e.g. id="YourFormId"). If no attribute is defined, mandatorily define one
!important: Set up form fields that you are interested in verify with the same field ID attribute. The more are set, the better to score the lead. If some fields do not exist, leave the vars empty
-->
<script type="text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery.md5.js"></script>
<script type="text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery.cookie.js"></script>
<script type="text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery.modal.0.9.1.min.js"></script>
<script type="text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery.color.js"></script>
<script type="text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/ua-parser.js"></script>

Then add and configure the following vars with the ID attribute of your fields. If you did not define ID attribute for your fields, please do so. If not used, just let the vars empty or delete them. Place your API key into lpm_aid, and the Session Recording token into lpm_srId. Please be aware that a Session Recording token is linked to a domain.

If you wish to use our SMS verification system (strongly recommended), you shoud define the var lpmVerifSMSActive to true. If you use our SMS verification system, you could also use our form validation system. Our form validation system is able to handle most of forms with level 1 (parent) and level 2 (child) fields (e.g. a level 2 field is a field that is displayed depending on selected value of a level 1 or parent field).

This part of the script just allows us to get the data from your form. To use our form validation system, follow the next steps.

<script type="text/javascript" id="lpmTkg">
// Define essential vars
var lpm_aid = ''; // provide API key (mandatory)
var lpm_srId = ''; // provide Session Recording token (mandatory for Gold plan and higher)
var lpmCountry = 'France'; // provide country used for landing page (mandatory)
var lpmVerifSmsActive = 'true'; // true to activate it, false to deactivate it (mandatory)
var lpmFormValidationActive = 'false'; // true to activate it, false to deactivate it (mandatory)
var lpmAdvertiserReference = ''; // define a reference of yours

// Define Form Name, Submit button & Fields
var lpm_formId = ''; // provide ID attribute from form (mandatory)
var lpm_formSubmitId = ''; // provide ID attribute from submit button (mandatory)
	
var lpm_fieldCivilityId = ''; // provide ID attribute from civility input or select field (optional)
var lpm_fieldLastnameId = ''; // provide ID attribute from last name input field (optional)
var lpm_fieldFirstnameId = ''; // provide ID attribute from first name input field (optional)
var lpm_fieldTelephoneId = ''; // provide ID attribute from telephone input field (mandatory)
var lpm_fieldEmailId = ''; // provide ID attribute from input field (mandatory)
var lpm_fieldAddressId = ''; // provide ID attribute from input field (optional)
var lpm_fieldPostcodeId = ''; // provide ID attribute from input field (optional)
var lpm_fieldCityId = ''; // provide ID attribute from input or select field (optional)
var lpm_fieldCommentsId = ''; // provide ID attribute from input or select field (optional)
</script>


WHY USE OUR FORM VALIDATION SYSTEM?

You could use our form validation system or use your own, as the third-party jQuery Validate Plugin. If you do use your own form validation system, please mind to trigger RTLS only when your form has been successfully validated. Otherwise, the lead will be transmitted to us each time the surfer clicks the submit button. Each lead transmitted is billable, even duplicates. If you want to avoid to be charged for duplicate leads (e.g. surfers that click multiple times), you should use our form validation system, or trigger RTLS only after performing a successful validation on your own.

If you wish to use our form validation system, please change the value of the lpmFormValidationActive var, that is defined above, to "true". If you do not want to use it, define it to "false".

If you use your own form validation system, delete every actions that were into the third-party submitHandler and put them into the function lpmFormHandler instead (refer to Form Handler below).

Then you can install our native form validation with this part of the script (you do not have to install the following script if you do not wish to use your validation system):

<script type="text/javascript">
// Form Validation Module
// How to proceed:
// Add [name;Name;text;false] into the var lpm_formvalidation_fields. Formate is : [field name;Field Named Displayed;data type;length]
// Parameter 1 (required): Replace name by the input name (not ID)
// Parameter 2 (required): Name to be displayed. Example : if name is firstname, write First Name
// Parameter 3 (required): Pick text, digit, both, radio/checkbox, or email. Text allows space, ', -, € and /
// Parameter 4 (optional): Set character number to false if no length is needed. If needed, set it to 1, 2, 3 and so on. Always false for radio and checkbox. If not set, it will be automatically set to false
// Parameter 5 (optional): Options for level 2 fields verification (e.g. depending on a level 1 field value). Formate : {fieldName:name,fieldValue:value1|value2|value3}. Example: state that there is a select named housing_situation with possible values 'owner' or 'tenant'. Only if the user click on 'owner', you want to display a new field named housing_type (you have to display it by your own means, we do not handle the display part). Then you want to check the validity of this new housing_type field. You then can add this field at the end of the lpm_formvalidation_fields queue this way: [housing_type;Housing Type;text;false;{fieldName:housing_situation,fieldValue:owner}]. It is very important that level 2 fields are added at the end of the queue.

// This works for all types of fields: input[type=text/password/email,etc], input[type=radio], input[type=checkbox], select, textarea
	
// Example : [civility;Civility;radio/checkbox;false][lastname;Last Name;text;false][firstname;First Name;text;false][phone;Phone;digit;10][country;Country;text;false][housing_situation;Housing Situation;text;false][comments;Comments;text;false][housing_type;Housing Type;text;false;{fieldName:housing_situation,fieldValue:owner}]
								   
var lpm_formvalidation_fields = 'your fields here';
var lpm_formvalidation_verbose = 'false'; // define it to true or false
</script>


TRIGGER RTLS WHEN NOT USING OUR NATIVE FORM VALIDATION SYSTEM

If you wish to use a third-party form validation system, that's okay. As already said, just delete every actions from the submitHandler of your third-party form validation system and place them into our lpmFormHandler().

After deleting these actions, trigger RTLS into the submitHandler of your third-party form validation system, as followed. Only when RTLS is triggered and performed, it will then trigger all the actions that you have now defined into lpmFormHandler.


Triggering RTLS

lpm_trigger_RTLS(true);


FORM HANDLER

The next part is to handle the action when the submit button is clicked and RTLS has been performed. It is mandatory in any case, whether you use our form validation system or a third-party form validation system. If you forget to define a form handler, nothing will happen after performing RTLS (right after the surfer clicks the submit button).

If you are using a third-party form validation system, please put into our lpmFormHandler all the actions you had before into the submitHandler of your third-party validation system. Instead of these actions you had, trigger RTLS (refer to Trigger RTLS when not using our native form validation system).

To handle any action, you should use the JavaScript function lpmFormHandler(). The followings are examples of how to handle your form, but it is up to you.


Form Handler - Example to submit the form

<script type="text/javascript">
function lpmFormHandler() {
	// To Submit the form the old fashioned way (if you need to, remember to always display conversion pixel before submitting. Once the form is submitted, displaying a conversion pixel would not work): 
	var lpmFormHandlerSubmit = $('#'+lpm_formId).unbind().submit();
	var lpmFormHandlerSubmitWithTimeout;
	lpmFormHandlerSubmitWithTimeout = window.setTimeout(lpmFormHandlerSubmit, 1000);
}
</script>

Form Handler - Example to display a conversion pixel

<script type="text/javascript">
function lpmFormHandler() {
	// To display conversion pixels with dynamic vars: 
	$(document.body).append('<img src="https://www.adserverexample.dot?advertiserid=xxx&email='+lpm_fieldEmailId+'" border="0" width="1" height="1" />');
}
</script>

Form Handler - Example to display a thank you message

<script type="text/javascript">
function lpmFormHandler() {
	// To display a thank you message on the same page:
	// If you need to display it instead of the form, empty fhe form first then add the thank you message to the DOM:
	$('#DivWithFormInside').fadeOut(600, function() {
		$(this).empty();
		$(this).append('<p>Thank you!</p>').hide().delay(600).fadeIn("slow"); 
	});
}
</script>

Form Handler - Example to display a thank you message - alternative way

<script type="text/javascript">
function lpmFormHandler() {
	// You may also just want to display the thank you message under the existing form. Then do not empty the form and just add the thank you message as shown:
	$('#DivWhereTheMessageWillBeDisplayed').append('<p>Thank you!</p>').hide().fadeIn("slow");
}
</script>

Form Handler - Ajax Data to your server

<script type="text/javascript">
// To Ajax the data to your server (you may add more fields):
function lpmFormHandler() {
	$.ajax({
		type: 'POST', // either POST or GET
		url: 'https://www.domain.dot',
		data: 'civility='+lpm_fieldCivilityId+'&lastname='+lpm_fieldLastnameId+'&firstname='+lpm_fieldFirstnameId+'&telephone='+lpm_fieldTelephoneId+'&email='+lpm_fieldEmailId+'&address='+lpm_fieldAddressId+'&postcode='+lpm_fieldPostcodeId+'&city='+lpm_fieldCityId
	});
}
</script>

Form Handler - Full Example

<script type="text/javascript">
function lpmFormHandler() {
	// Of course, you can mix these methods. For instance, you can ajax the form, then display the conversion pixel and then submit the form: 
	$.ajax({
		timeout: 3000,
		type: 'POST', // either POST or GET
		url: 'https://www.domain.dot',
		data: 'civility='+lpm_fieldCivilityId+'&lastname='+lpm_fieldLastnameId+'&firstname='+lpm_fieldFirstnameId+'&telephone='+lpm_fieldTelephoneId+'&email='+lpm_fieldEmailId+'&address='+lpm_fieldAddressId+'&postcode='+lpm_fieldPostcodeId+'&city='+lpm_fieldCityId,
		success: function(ajaxResponse) {
			// You may use the var ajaxResponse, which contains what is displayed on the webpage called by ajax
			// Be warned of CORS issues: https://developer.mozilla.org/fr/docs/Web/HTTP/CORS

			// add the conversion pixel to the DOM so the agencies and publishers know that a lead has been generated in order to charge it
			// you can use Bluebird jQuery API to get lead's score to be able to decide whether you wish to display the publishers' conversion pixels to pay the lead or not

			$('<img src="https://www.adserverexample.dot?advertiserid=xxx&email='+lpm_fieldEmailId+'" border="0" width="1" height="1" />').appendTo(document.body);


			// Either choose Option 1- to actually submit the form (if you have a real thankyou page after this page, as step 2): 
				// actually submits the form after a timeout of 1 second to allow the conversion pixels to be displayed
				var lpmFormHandlerSubmit = $('#'+lpm_formId).unbind().submit();
				var lpmFormHandlerSubmitWithTimeout;
				lpmFormHandlerSubmitWithTimeout = window.setTimeout(lpmFormHandlerSubmit, 1000);

			// Or Option 2- to display a thank you message (delete one of the useless options): 
				$('#DivWithFormInside').fadeOut(600, function() {
					$(this).empty();
					$(this).append('<p>Thank you!</p>').hide().delay(600).fadeIn("slow"); 
				});
		}
		error: function(xhr, ajaxOptions, thrownError) {
			// log the error into the browser console to correct the issues
			console.log('Ajax statuts: '+xhr.status+'. Error Details: '+thrownError);

			// you can also decide to display an error to ask the user to submit the form again
		}
	});
}
</script>


CALLING FOR RTLS SCRIPT

The last part is to insert the RTLS JavaScript. It is mandatory. It is the core of RTLS:

<script type="text/javascript">
(function() {
	var lpm = document.createElement('script');
	lpm.type = 'text/javascript';
	lpm.async = true;
	lpm.src = 'https://www.rtlsbybluebird.com/tkg/js/analytics.js';
	var s = document.getElementsByTagName('script')[0];
	s.parentNode.insertBefore(lpm, s);
})();
</script>
<!-- RTLS / End -->

How to get the score when the surfer clicked the submit button

Once the surfer clicked the submit button and the lead is transmitted to us, our algorithm compute a unique score based on multiple parameters. To get this score, you should get the Surfer Unique ID (SID) from the cookie we put on the surfer's browser. You could access the score by two different ways, jQuery or PHP, depending on your needs.


Here is a full example of getting the lead score with script in PHP using cURL with GET method:

<?php
$sid = $_COOKIE['lpm_sid'];

// get lead score
// cURL call to the API
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.rtlsbybluebird.com/tkg/php/get-lead-score.php?sid='.$sid);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 3);

$result = curl_exec($curl);
curl_close($curl);

$json_object = json_decode($result);
$lead_score = $json_object->lead_score;

// do whatever you want with $lead_score variable


?>

Here is a full example of getting the lead score with script in jQuery (do not forget to call jQuery framework if needed, otherwise the following script will not work):

<script "text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery-3.3.1.min.js"></script>
<script "text/javascript" src="https://www.rtlsbybluebird.com/tkg/js/jquery.cookie.js"></script>
<script type="text/javascript">
// get lead score
$.ajax({
	timeout: 3000,
	type: 'GET',
	url: 'https://www.rtlsbybluebird.com/tkg/php/get-lead-score.php',
	data: 'sid='+$.cookie("lpm_sid"),
	success: function(getLeadScore) {
		var json_object = JSON.parse(getLeadScore);
		var leadScore = json_object.lead_score;	
		
		// do whatever you want with leadScore variable
		
		
	},
	error: function(xhr, ajaxOptions, thrownError) {
	  console.log('Get Lead Score: xhr status is '+xhr.status+' and error is '+thrownError);
	}
});
</script>

We recommend that you keep only leads with a minimum score of 7/10. For even better performance, you should keep leads with a score higher than 8/10 only.

We also recommend that you accumulate up to 3 months of RTLS lead score data before considering to actually use the scores. We call it the test period. Each advertiser gets different ranges of scores depending on the media and audiences they use, and so many more parameters. Thus, before you decide to keep or to waste a lead, please evaluate properly the average of scores you got during the test period. In this way, you will avoid to keep too much leads with bad quality, or on the contrary, you will avoid to waste too much workable leads.


Expected Output

The expected output when calling get-lead-score.php is a JSON object with several items that you can exploit as your own convenience. The main item is lead_score, but you can also save other items as you may need them.


Here is an example of a JSON object returned when calling get-lead-score.php:

{"sid":"a3352ca9ce71594a1b5fc632fda91e7312a005be5c3e849f2ba6915c7a678ddc66c7087f0868a65e520fb7c4774325d7","email":"firstname.lastname@lead-email-provider.com","registration_timestamp":"1551093388","registration_date":"2019-02-25 12:16:28","ip":"85.204.88.184","visits":"3","time_spent":"28 seconds","device":"desktop","os":"Mac OS","browser":"Firefox","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0","location":"http://www.your-landing-page.com","referrer":"null","lead_score":"9.09","score_specs":{"hlr":"passed","disposable_phone":"passed","sms":"passed","email":"passed","address":"passed","antifraud_ip":"passed","geoip":"passed","vpn":"passed","antifraud_webrtc":"passed"}}


For the score specifications (score_specs), there are three possible results:

  • passed: the specific data has been validated
  • failed: the specific data has not been validated
  • null: the specific data is missing and no validation was performed

Copyright © 2018-2024 Bluebird - All Rights Reserved | Legal | Terms & Conditions