Dynamic Web Content enables you to change the page that is served on your site based on a visitor's characteristics. A lead visits your site for the first time? Provide them a white paper or educational document. A visitor's Lead Score indicates they are ready to buy? Offer an instant discount to close the deal. The possibilities are truly endless. In this support article we'll get started with Dynamic Web Content by adding it to SharpSpring's tracking code.
Adding Dynamic Web Content to the SharpSpring Tracking Code
Adding Dynamic Web Content is as simple as adding the following snippet to SharpSpring's tracking code on your site.
In order to create Dynamic Content for a lead, make sure that you include the "callThisOnReturn" function within your script. This function receives a response object with a "lead" object inside that will contain all of the standard and custom fields attributed to the lead.
NOTE: All manipulation of the page needs to occur within this function, as the response lead object will not be available outside.
Custom fields will be referred to by their label in the system, just like the system fields. Also, SharpSpring will only return fields that contain values. This applies to system fields and custom fields. If there is no value in the field, the field will not be returned in the response object at all. As such, all code referencing specific fields should be written with the understanding that the fields sometimes will not be present if empty. This is opposed to returning a 'null' or a blank value—they are omitted from the response.