WordPress

Guide to installing Woopra on a Wordpress site

WordPress Installation

The WordPress app seamlessly tracks all WordPress events, such as when a visitor performs a search on your website, which articles (Woopra considers blog posts as articles) they read, pageviews, and more. This integration makes it extremely simple for you to access a comprehensive WordPress-customized analytics suite within minutes.

With the WordPress app, you will have access to reports detailing top authors, top categories, reader retention, and more.

Note: This plugin automatically adapts to the WooCommerce WordPress plugin so that you can seamlessly track e-commerce transactions as well.

If your site is powered by WordPress, there are two ways to install the Woopra plugin:

Automatic Install

  1. Sign in to your WordPress Dashboard at yourdomain.com/wp-admin
  2. Click on the “PlugIns” menu-item in the menu on the left
  3. Below “PlugIns” in the menu on the left, click “Add New”
  4. Search for Woopra
  5. Click “Install Now” underneath the Woopra plugin
  6. You can view your site’s stats by visiting https://app.woopra.com/

Manual Install

  1. Download the Woopra WordPress Plugin from http://wordpress.org/plugins/woopra/
  2. Extract the Woopra.zip file to a location on your local machine
  3. Upload the Woopra folder and all contents into the /plugins/ directory
  4. You can view your site’s stats by visiting https://app.woopra.com

Using this App

After installation, you will need to configure the events that you wish to track within your WordPress dashboard. You can find these options by selecting Settings, then select Woopra from the list.

Form Tracking

We recommend using the Contact Forms 7 or Gravity Forms plugin.

Contact Forms 7

In the following example, we are using Contact Forms 7: https://wordpress.org/plugins/contact-form-7/.

Once you have installed the Wordpress Plugin and Contact Forms 7 you can add the following code to the header.php file found under the theme settings. You will insert the code after the

<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
	woopra.identify({
		name: document.querySelector("input[name=your-name]").value,
  		email: document.querySelector("input[name=your-email]").value
	});


    woopra.track("submit form", {
	message: document.querySelector("textarea[name=your-message]").value
})
})
</script>

After you save the file, you can test to see if your forms are being correctly tracked in Woopra. To test, you can find your profile before you submit the form, then refresh the list of users in the people profiles and see if your profile has been updated with the information you submitted.

Gravity Forms Example

<?php

add_action("gform_after_submission_1", "woopra_contact_form", 10, 2);

function woopra_contact_form($entry, $form) {
 $data = array(
  "fullname" => $entry[1],
  "email"    => $entry[2],
  "phone"    => $entry[3],
  "website"  => $entry[4],
  "subject"  => $entry[5]    
 );
$user_data = array (
  "name"  => $entry[1],
  "email" => $entry[2]
);
 do_action("woopra_identify", $user_data);
 do_action("woopra_track",  "contact form", $data, true);
}

?>