About Convertize

Installing Convertize

With Website Builder

With Tag Manager

Manually

Using Convertize

Managing Experiments

Targeting & Tracking

SmartPlugins

Advanced Use

Your Results

Technical Info

Billing

How to track conversions with JavaScript

Convertize allows you to track different types of goals: Click Goals and Page-view Goals. You can create these goals in the SmartEditor. For advanced users, however, we also have to option to track goals with JavaScript. This article discusses both options.

Click Goals: tracking clicks on an element on the page

As shown in the screenshot above, setting up a Click Goal simply requires you to click on the element you would like to track, and then select “Track Click” from the menu. The platform will now track any clicks on this element and show them as conversions on your Analytics page.

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.

Example 1: track all your buttons in one go

Let’s say you want to create click goals for all the buttons on your page without clicking all of them to activate tracking.

You can do this as follows:

step 1: in the editor, create a click goal for one of the button on the page and give it a name
step 2: add an event listener to you website buttons to push the conversion to Convertize, for example:

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

Replace name_of_your_click_goal with the name you gave the goal in step 1. This name will also appear on the results page of your experiment in a conversion graph.

Make sure the pages you fire your goal on are included in the URL targeting of your experiment.

Example 2: tracking a Lightbox modal

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>

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.

Make sure the pages you fire your goal on are included in the URL targeting of your experiment.

Page-view Goals: tracking navigation to a particular page

As you can see in the screenshot above, you can create Page-view Goals in the Options menu. With this type of goal, you can track your visitors navigations to a particular page from the page you are optimising.

For example, if I’m optimising my newsletter sign-up page, I might want to find out how many visitors sign up. To achieve this, I can create a Page-view goal for the “Thank You” page that is displayed after submitting the sign-up form. Every visitor who has seen this page, has signed up.

To create a Page-view Goal. I open the Options menu and navigate to the Goals tab. I give my Page-view Goal a name and make sure to enter the URL of the correct page.

Advanced Tracking of Page-view Goals

A Page-view Goal is triggered whenever the URL of the page matches the settings of the goal.

step 1: in the editor, create a page-view goal with nonsense URL targeting that would never be triggered. Give your page-view goal name.

step 2: add the following bit of JavaScript to push your conversion to Convertize, for example:

<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.

Make sure the pages you fire your goal on are included in the URL targeting of your experiment.

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.

About Convertize

Installing Convertize

With Website Builder

With Tag Manager

Manually

Using Convertize

Managing Experiments

Targeting & Tracking

SmartPlugins

Advanced Use

Your Results

Technical Info

Billing