When to Load an HTML Code to Track Conversions

In case you are using the “Custom HTML” element to add a conversion tracking script to one of your pages, there is an important thing that you should consider:

When should the HTML code snippet/the script you add loaded on the page?

Thrive Leads

When you edit a form that appears in Thrive Leads, you have the possibility to edit it in multiple states.

Default state of forms

If you add a script, using the “Custom HTML” element, to the default state of the form, you will not have to select a time when to load the script, since the default state of the form will always be displayed on page load.

Non-default state of forms

However, if you add the script to a non-default state, you will have to choose when to load the respective script in order to make sure it will track conversions accurately.

When should you add conversion tracking to non-default states?

  • Adding a conversion tracking script to a multi-state form can come in handy if, for example, you are using a ‘Thank You’ non-default state after someone subscribes to your newsletter, on the first, default state of the form.​Here you can track the conversions, on the ‘Thank You’ state, in a tool like Google Analytics, but you need to add a script to the ‘Thank You’ state first. You can use the “Custom HTML” element to add the tracking script to the ‘Thank You’ state and you can choose to load the script only if this state is shown.
  • Another instance would be if you have a multiple choice opt-in form and you want to re-target the users, based on a choice they made on the respective opt-in form. Let’s say you have an opt-in form with a question and three possible answers, for example:- What is your level of expertise?




Your goal is to show different states of the form after a visitor clicks on one of the answers, based on his/her answer. With the “Custom HTML” element, you can add a tracking code (e.g. Facebook Pixel) to each of the different states and then, show relevant offers (beginner offer for beginners, etc.) to your audience on Facebook.

In such cases, you will need to use the “When to load” option to establish when the conversion tracking script should be loaded.

How to use the “When to load” option

When you add the “Custom HTML” element to the non-default state of the form, the “when to load” section will appear in the pop-up window. Click on the down arrow from the “Choose the moment” field:

Two options will appear that you can choose from: “On page load” and “When the visitor views the state”:

Decide which one suits your needs, according to the following information:

  • On page load – if you choose this option, the script will be executed/loaded immediately when the Thrive Leads form is loaded on the page.
  • When the visitor views the state – choosing this option will execute/load the script anytime a visitor will do something on the page that will make the non-default state active (see the examples above). Depending on how you set up the form, this could be that the visitor signs up to the form and the non-default state is the success state that he/she reaches, or the non-default state could be opened by clicking on a button etc.

Thrive Quiz Builder

When you use Thrive Quiz Builder to build quizzes for your website, there are two separate ways in which you can proceed. You can either make a quiz with one result page or a quiz with dynamic results.

Quizzes with one result page

If you want to add a conversion tracking script to a quiz that has one result page, using the “Custom HTML” element, you will not have to choose when to load the respective script. This happens automatically: the script/code, added with the “Custom HTML” element, is always loaded in the moment when the result page is displayed, so you don’t need to select an exact time for it.

Quizzes with dynamic results

When you build a quiz with dynamic results, using the “Dynamic Content” feature, you can add the “Custom HTML” element with the script within the dynamic content container.

You will not have to select when the script is loaded in this case either, because this way the script will load when the dynamic content container is shown.

Thus, Thrive Quiz Builder will execute/load the script whenever one of the dynamic result pages is displayed, regardless of which result that is. If you want to find out more about the “Custom HTML” element, check out this tutorial.

Was this article helpful?

Related Articles