Unbounce’s conversion goals provide users with a way to track the success of their landing pages.

In order to active this feature in our apps, there’s a function provided by Smart Builder SDK titled getAfterFormSubmitScript.

You can use this function from the following package:

import { getAfterFormSubmitScript } from 'config/global-dependencies/smart-builder-sdk'

This function also require two arguments, the first one is entityId (string) and the second one is trackingEnabled (boolean).

Note, when you call getAfterFormSubmitScript with the proper arguments, it will return a code that must be called on the published page for the conversion to go through.

Example

We often follow a pattern with all the apps that are able to implement this conversion feature. Let’s dive into it.

Before we add tracking conversion to an application, a tracking property is needed in our app schema. The following code shows how to declare this property:

const schema = Schema.object({
  itemId: Schema.string(),
  date: Schema.string(),
  tracking: Schema.formUrl(), // tracking property
});

Notice that formUrl() is being used for this property. For more information about the Schema please visit the following page: Schema Methods/Types

To allow user to active or deactivate conversions, commonly a toggle component is created and added to the app controls: