How to collect lead parameters from the URL

In this guide, we will learn how to collect the lead parameters from the URL in order to fire the leads with the Email, Name, Phone, and more.

What is the benefit of having those parameters?

The more valued parameters you send from AnyTrack to Facebook, the higher the match rate that your event will get. Also, sending facebook the events with the details like Email will help for the advanced matching.

To implement this method, you will need the following:

  1. 3rd party platform that supports adding the parameters in the URL.

  2. An AnyTrack account.

  3. Have AnyTrack Tag on all the pages of the funnel.

Setup:

  1. Make sure that the lead generation platform appends the lead details as URL parameters.

For example: on phonesites, on the thank you page settings, you can enable the Attach Data switch:

phonesite.png

After doing it, this is the result after submitting a form:

Screen_Shot_2022-04-04_at_11_06_42.png

2. Add this code to the thank you page:

<script>  
function getParameter(parameterName){  
let parameters= new URLSearchParams(window.location.search);
return parameters.get(parameterName);
}
</script>  
<script>  
  var click_id = AnyTrack('trigger', 'Lead', {
	fullName: getParameter("name"),
	email: getParameter("email"),
	phone: getParameter("phone"),
});
</script>

This is it 🎉

Now AnyTrack will fire Lead events with the advanced parameters.

  • With the code above, AnyTrack will pull the Name, Email, and Phone number. In case you would like to add more parameters, you can review the supported parameters here.

  • There is the possibility that your lead generation platform calls the parameters by different names, which might affect the results. In case you face difficulties, reach out to our support.