Browse Help Center
Browse Help Center
Join 20,000+ other marketers and start getting marketing clarity

Subscribe to our newsletter and get proven marketing strategies for growing your business.

    Related Integrations
    Ecommerce Shopify

    Last update on July 22, 2022

    Shopify
    Ecommerce BigCommerce

    Last update on August 15, 2022

    BigCommerce
    Ecommerce WooCommerce

    Last update on September 1, 2022

    WooCommerce
    Help Center Integrations WooCommerce Integration

    Ecommerce Tracking for WooCommerce


      Note: You must have your WhatConverts Tracking Code placed in the <head> of the page. If you are using the WhatConverts WordPress Plugin or Google Tag Manager, you will need to deactivate that and place the HTML Tracking Code in the header of your page. You can use a plugin such as Insert Headers and Footers to accomplish this.

    1Download, install and activate the Code Snippets Plugin.
    2Hover over "Snippets", select "Add New" from the menu. Give your Snippet a name and paste the following in the Code section.

    add_action( 'woocommerce_thankyou', 'whatconverts_tracking' );
    function whatconverts_tracking($order_id) {
    	if ($order_id > 0) {
    		$order = wc_get_order($order_id);
    		if ( $order instanceof WC_Order ) {
    			$completion_date = empty($order->get_date_paid()) ?  strtotime($order->get_date_created()) :  strtotime($order->get_date_paid());
    			$current_date = new Datetime();
    			$time_difference = $current_date->format('U') - $completion_date;
    			if ($time_difference < 180) {
    				$email = $name = $phone_number = $company = $address_1 = $address_2 = $city = $state = $postcode = $country = '';
    				if (!empty($order->get_billing_email()))
    					$email = $order->get_billing_email().' ';
    				if (!empty($order->get_billing_first_name()))
    					$name .= $order->get_billing_first_name().' ';
    				if (!empty($order->get_billing_last_name()))
    					$name .= $order->get_billing_last_name();
    				if (!empty($order->get_billing_phone()))
    					$phone_number = $order->get_billing_phone();
    				if (!empty($order->get_billing_company()))
    					$company = $order->get_billing_company();
    				if (!empty($order->get_billing_address_1()))
    					$address_1 = $order->get_billing_address_1();
    				if (!empty($order->get_billing_address_2()))
    					$address_2 = $order->get_billing_address_2();
    				if (!empty($order->get_billing_city()))
    					$city = $order->get_billing_city();
    				if (!empty($order->get_billing_state()))
    					$state = $order->get_billing_state();
    				if (!empty($order->get_billing_postcode()))
    					$postcode = $order->get_billing_postcode();
    				if (!empty($order->get_billing_country()))
    					$country = $order->get_billing_country();
    				echo '<script type="text/javascript">
    				//<![CDATA[
    				wc_transaction_ypbib
    				(
    				"'.$order->get_id().'",
    				"'.$order->get_total().'",
    				"'.$order->get_total_tax().'",
    				"'.$order->get_shipping_total().'",
    				{';
    				if (!empty($email))
    					echo '"Email Address": "'.$email.'",';
    				if (!empty($email))
    					echo '"Name": "'.$name.'",';
    				if (!empty($company))
    					echo '"Company": "'.$company.'",';
    				if (!empty($address_1))
    					echo '"Address 1": "'.$address_1.'",';
    				if (!empty($address_2))
    					echo '"Address 2": "'.$address_2.'",';
    				if (!empty($city))
    					echo '"City": "'.$city.'",';
    				if (!empty($state))
    					echo '"State": "'.$state.'",';
    				if (!empty($postcode))
    					echo '"Postal Code": "'.$postcode.'",';
    				if (!empty($country))
    					echo '"Country": "'.$country.'",';
    				echo '}
    				);
    				//]]>
    				</script>';
    			}
    		}
    	}
    }
    

    Select "Run snippet everywhere".

    Run Snippet Everywhere

    Click "Save Changes and Activate".

    3If you have a test product, you can go ahead and go through the checkout process. When you get to the Successful Order page, check the WhatConverts Lead Manager for the successful transaction.

    Completed Ecommerce Transaction

    If you have any questions, please contact us here: Contact WhatConverts Support or email support@whatconverts.com

    WooCommerce is an eCommerce platform for building online businesses. If you're using WooCommerce in WordPress, WhatConverts can track the transactions and display them in your WhatConverts dashboard.

      Note: You must have your WhatConverts Tracking Code placed in the <head> of the page. If you are using the WhatConverts WordPress Plugin or Google Tag Manager, you will need to deactivate that and place the HTML Tracking Code in the header of your page. You can use a plugin such as Insert Headers and Footers to accomplish this.

    1Download, install and activate the Code Snippets Plugin.
    2Hover over "Snippets", select "Add New" from the menu. Give your Snippet a name and paste the following in the Code section.

    add_action( 'woocommerce_thankyou', 'whatconverts_tracking' );
    function whatconverts_tracking($order_id) {
    	if ($order_id > 0) {
    		$order = wc_get_order($order_id);
    		if ( $order instanceof WC_Order ) {
    			$completion_date = empty($order->get_date_paid()) ?  strtotime($order->get_date_created()) :  strtotime($order->get_date_paid());
    			$current_date = new Datetime();
    			$time_difference = $current_date->format('U') - $completion_date;
    			if ($time_difference < 180) {
    				$email = $name = $phone_number = $company = $address_1 = $address_2 = $city = $state = $postcode = $country = '';
    				if (!empty($order->get_billing_email()))
    					$email = $order->get_billing_email().' ';
    				if (!empty($order->get_billing_first_name()))
    					$name .= $order->get_billing_first_name().' ';
    				if (!empty($order->get_billing_last_name()))
    					$name .= $order->get_billing_last_name();
    				if (!empty($order->get_billing_phone()))
    					$phone_number = $order->get_billing_phone();
    				if (!empty($order->get_billing_company()))
    					$company = $order->get_billing_company();
    				if (!empty($order->get_billing_address_1()))
    					$address_1 = $order->get_billing_address_1();
    				if (!empty($order->get_billing_address_2()))
    					$address_2 = $order->get_billing_address_2();
    				if (!empty($order->get_billing_city()))
    					$city = $order->get_billing_city();
    				if (!empty($order->get_billing_state()))
    					$state = $order->get_billing_state();
    				if (!empty($order->get_billing_postcode()))
    					$postcode = $order->get_billing_postcode();
    				if (!empty($order->get_billing_country()))
    					$country = $order->get_billing_country();
    				echo '<script type="text/javascript">
    				//<![CDATA[
    				wc_transaction_ypbib
    				(
    				"'.$order->get_id().'",
    				"'.$order->get_total().'",
    				"'.$order->get_tax_totals().'",
    				"'.$order->get_shipping_total().'",
    				{';
    				if (!empty($email))
    					echo '"Email Address": "'.$email.'",';
    				if (!empty($email))
    					echo '"Name": "'.$name.'",';
    				if (!empty($company))
    					echo '"Company": "'.$company.'",';
    				if (!empty($address_1))
    					echo '"Address 1": "'.$address_1.'",';
    				if (!empty($address_2))
    					echo '"Address 2": "'.$address_2.'",';
    				if (!empty($city))
    					echo '"City": "'.$city.'",';
    				if (!empty($state))
    					echo '"State": "'.$state.'",';
    				if (!empty($postcode))
    					echo '"Postal Code": "'.$postcode.'",';
    				if (!empty($country))
    					echo '"Country": "'.$country.'",';
    				echo '}
    				);
    				//]]>
    				</script>';
    			}
    		}
    	}
    }
    

    Select "Run snippet everywhere".

    Run Snippet Everywhere

    Click "Save Changes and Activate".
    3If you have a test product, you can go ahead and go through the checkout process. When you get to the Successful Order page, check your WhatConverts account for the successful transaction.

    Was this page helpful?
    👍Yes
    👎No
    Get a FREE presentation of WhatConverts

    One of our marketing experts will give you a full presentation of how WhatConverts can help you grow your business.

    Schedule a Demo
    Whatconverts Features for your Business
    Ecommerce Tracking in Google Analytics
    Lead Tracking Ecommerce Tracking in Google Analytics

    Measure the exact revenue that each of your leads generated via eCommerce.

    Append Marketing Data to Orders (WordPress)
    Lead Tracking Append Marketing Data to Orders (WordPress)

    See which marketing source, campaign or keyword is responsible for online orders.

    Join 20,000+ other marketers and start getting marketing clarity

    Subscribe to our newsletter and get proven marketing strategies for growing your business.

      Related Integrations
      Ecommerce WooCommerce

      Last update on September 1, 2022

      WooCommerce
      Ecommerce Squarespace

      Last update on September 1, 2022

      Squarespace
      Ecommerce BigCommerce

      Last update on August 15, 2022

      BigCommerce
      ready to get marketing clarity?

      Grow your business with WhatConverts

      14 days free trial Easy setup Dedicated support
      G2 Users Love Us Badge
      G2 High Performer Badge
      G2 High Performer Small Business Badge
      G2 Momentum Leader Badge
      G2 High Performer Europe Badge