About Convertize

Account

Technical Info

Installing Convertize

Billing

Using Convertize

Installing Convertize with:

How to track conversions with JavaScript

Convertize allows you to track different types of goals, such as clicking on an element on the page or navigating to a page on a different domain. These goals are created in the SmartEditor.

As shown in the screenshot above, setting up a goal simply requires you to click on the element you would like to track, and then select ‘Track Click’ from the menu.

Advanced Tracking of Click Goals

For most users, setting up goals in the SmartEditor is sufficient – you can just sit back and wait for the conversions. However, advanced users may require extra flexibility to track goals. Let’s say you are working on a Lightbox modal or custom JavaScript library and want to track a click whenever a certain piece of JavaScript code runs. You can do this by inserting the following bit of JavaScript:

<script>
    window.convertize = window.convertize || [];
    convertize.push('goal', {type: 'click', name: 'name_of_your_click_goal'});
</script>

Be sure to replace name_of_your_click_goal with the name you gave the goal in the SmartEditor. This name will also appear on the results page of your experiment in a conversion graph.

Tracking Page-view Goals

A page-view goal is triggered whenever the url of the page matches the settings of the goal. If you manually track a page-view goal with the following code, it will only convert if the url matches the settings. For example, if the goal was configured to “START WITH http://www.my_website.com” then the current url must begin with this.

<script>
    window.convertize = window.convertize || [];
    convertize.push('goal', {type: 'page-view', name: 'name_of_your_pageview_goal'});
</script>

Be sure to replace name_of_your_pageview_goal with the name you gave the goal in the SmartEditor. This name will also appear on the results page of your experiment in a conversion graph.

Tracking page-view goals in this way is useful if you change the URL of the page without reloading it. This is common in single-page applications or when using Javascript to manipulate the browsing history.