Retrieving Ontrapage Visit & Conversion Data as .CSV Download

Sometimes, it’s easier to download data into a spreadsheet to analyze it–for example, data about your Ontrapages (e.g., visits and conversions).

The Ontraport app provides a columnar view of your Ontrapages that you can sort by overall visits or conversions. However, it doesn’t have a column for “conversion rate” (conversions per visit) and it doesn’t list your pages by versions (unless you go into the stats for an individual page) so you can compare across both pages and their various versions (which you’ll have if you’re doing A/B or A/B/C/D testing within your pages).

I thought it would be helpful to download my Ontrapage data into a spreadsheet to do more extensive analyses using the following columns/fields:

Page Name Page Version Visits Conversions Conversion Rate

It turns out to be relatively easy to output the Ontrapage data using PHP and the Ontraport API. I wrote a script that you can download here.

To get this script to work, you need to have FTP access to a webserver set up to run PHP scripts (note: if you have a WordPress website, your server is able to execute PHP scripts).


  1. Download and unzip the file from the link above
  2. Open the extracted PHP file (“download_ontrapages_data_csv.php”) and open it in a text editor
  3. Replace the x’s with your Api-Appid and Api-Key you’ll find for your WordPress website in the Ontraport app. If you have Pilotpress installed at the website, you can look in your Pilotpress settings at the website to get them. Save your changes.
  4. ‘Api-Appid: xxxxxxx’,
    ‘Api-Key: xxxxxxxx’
  5. Upload the updated “download_ontrapages_data_csv.php” file to your WordPress webserver; it can be in almost any directory on your server (you can create a “scripts” folder at your server and put it there if you want).
  6. Link to the uploaded file from a page at your website; your link should look something like
  7. After saving the page with the link, view the page in a browser and click the link. It should open a dialog that asks if you want to download or open the file it’s about to download (“file.csv”).

If you open the file in Excel, it’ll look something like this:

That’s it! If you are unfamiliar with FTPing files to a server, maybe you’ve got a programmer-type friend who would give you a hand..:).