Using the Conversion Code

The Conversion Code is a snippet of code that sends Improvely details about conversion events you want to track. For example, you can track when your website visitors:

  • Sign up for a newsletter
  • Fill out a contact form
  • Add an item to a shopping cart
  • Complete a purchase

From your project’s settings page, click on the Get This Project’s Website Code button to retrieve the Website Code, Conversion Code and Visitor Labeling Code for your site.

To add the code to your website:

  1. Click the Copy to Clipboard button to copy the code to your computer’s clipboard. Alternatively, highlight the code with your mouse and press CTRL+C or CMD+C.

    Conversion Code

  2. Paste the code into the page you want to track. This is the page shown after your conversion goal is completed, like the “thank you” page shown after someone makes a purchase or signs up.

  3. Customize the code to reflect the goal you want to track.

    Change the highlighted goal, revenue and reference values in the code to reflect what you want to track.

    • Goal: The name of your conversion goal, such as ‘sale’ or ‘newsletter signup’.
    • Revenue: The amount of revenue associated with the conversion, like a shopping cart total. It can be 0. Don’t include commas or currency symbols.
    • Reference: An optional value like an order number or e-mail address to help you match up conversions in Improvely with your other data.

  • You can track multiple different conversion goals on your site.

    Copy the code, edit the highlighted portion to reflect your new goal, and paste it into the webpage someone sees after completing the goal. Repeat for each additional event you want to track.

  • The goal name, revenue and reference values in the code can be dynamic.

    You can output values from your shopping cart or other website software within the conversion tracking code to pass things like order totals or order numbers to Improvely.

Below is an example of the Conversion Code edited to reflect a newsletter subscription instead of a purchase. This example also shows how you might integrate dynamic values from your website software. In this instance, we’re printing out an e-mail address stored in a PHP variable as the optional reference data:

<script type="text/javascript" src=""></script>
<script type="text/javascript">
improvely.init('demo', 1);
	goal: 'Newsletter Signup',
	revenue: 0,
	reference: '<?php echo $email; ?>'
<img src="<?php echo $email; ?>" width="1" height="1" />

Important: Do not copy the code from this example. You have to copy and modify the code from your own account.

More from this category
Conversion tracking and click fraud monitoring for all your marketing.   Start a Free Trial