Easy to Understand Website Reports with WordPress, Google Analytics & Google Sheets

@1daywebsitech

Problem

Your client likes to know who visits his website but does not understand the typcial web analytics lingo like: "pageviews", "sessions", "bounce rate" and so on.

Solution? Create custom reports your client understands

The Steps to Set Up Web Analytics

Go to google.com/analytics/ and create a Google Analyics account (it's free, all you need is a Google account)

Clean and easy to understand settings page

Go to support.google.com/analytics and select "Get Started with Analytics"

Links to complete this slideshow:

 

https://wordpress.org/plugins/ga-google-analytics/

https://support.google.com/analytics/answer/1008015?hl=en&ref_topic=3544906

https://support.google.com/analytics#topic=3544906

https://www.blogmojo.de/opt-ins-und-opt-outs-in-wordpress-einbinden/

https://easyrechtssicher.de/opt-out-google-analytics/

https://wordpress.org/plugins/autodescription/

https://yoast.com/google-analytics-dashboards/

https://conceptcreative.club/wp-admin/options-general.php?page=ga-google-analytics

 

 

 

 

Possible Workflow

Polylang & WooCommerce Integration:

How Complete?

Polylang & WooCommerce Integration:

How Complete?

WooCommerce Pages Routing

Directing shoppers to WooCommerce Page in chosen language (Shop, Cart, Checkout, Terms, etc.

/**
* @desc Multilingual WooCommerce Pages Routing -
* Option One: Page Routing with default Shop Page slug from Permalinks Shop Base
* @author woomultilingual.com
* @return int $id
*/
// Woocommerce WooCommerce Pages Routing - Option Shop Base Slug
add_filter ( 'woocommerce_get_shop_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_cart_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_checkout_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_terms_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_myaccount_page_id','woomulti_woocommerce_get_page_id' );
function woomulti_woocommerce_get_page_id( $id ) {
   if ( function_exists ( 'pll_get_post' ) ) {
      return pll_get_post( $id );
   }
   return $id;
}

WooCommerce

Cart Page – Return to Shop & Continue Shopping Redirect

//Cart Page – Return to Shop & Continue Shopping Redirect
function woomulti_woocommerce_return_to_shop_redirect() {
   if (function_exists ( 'pll_current_language' ) ) {
      $currentlang = pll_current_language();
      if ( $currentlang=="de" ) {
         return site_url ( '/de/shop/' );
      } elseif ( $currentlang=="fr" ){
         return site_url ( '/fr/shop/' );
      } else {
         return get_permalink( woocommerce_get_page_id( 'shop' ) );
      }
   }
}
add_filter( 'woocommerce_return_to_shop_redirect', 'woomulti_woocommerce_return_to_shop_redirect' );
add_filter( 'woocommerce_continue_shopping_redirect', 'woomulti_woocommerce_return_to_shop_redirect' );

What is wpml-config.xml?

https://wpml.org/documentation/support/language-configuration-files/

Admin Texts / wp_options

Polylang fully supports WPML configuration files

Let's look at how this works

Goal:

Translating "Flat Rate" Label on the Cart Page

WooCommerce Shipping Options

Flat Rate - Method Title

WP Options

/wp-admin/options.php

woocommerce_flat_rate_settings

Create XML File:

wpml-config.xml

Save file in active theme directory

Polylang Settings – Strings translation

New String named Flat Rate

Polylang Settings – Strings translation

Translate into available languages

Cart Page

Correct Label (in French) showing up

WPML Config file

All Standard Shipping Options

WooCommerce Helper Plugins

WooCommerce Pay for Payment

Credit Card Charge – WooCommerce for Stripe

WooCommerce Helper Plugins

WooCommerce Pay for Payment

Don't know the settings name? Use your browser's "Inspect Element"

WooCommerce Helper Plugins

WooCommerce Pay for Payment

Add correct key name to Stripe for WooCommerce settings:

WooCommerce Helper Plugins

WooChimp Subscribe Widget

Last Name, First Name are dynamic fields

Strings from nested options arrays

Start with an option dump:

var_dump ( get_option('woochimp_options') )

WooCommerce Helper Plugins

WooChimp Subscribe Widget

What we need is

the array:

woochimp_widget_fields,

with key 1 and key 2

WooCommerce Helper Plugins

WooChimp Subscribe Widget

<key name="woochimp_options">
   <key name="woochimp_widget_fields">
      <key name="1">
         <key name="name" />
      </key>
      <key name="2">
         <key name="name" />
      </key>
   </key>
</key>

Complete nested keys for wpml-config.xml

WooCommerce

Product Attributes

Creating Variable Products (for filtering)

https://docs.woothemes.com/document/variable-product/

WooCommerce Product Attributes

Custom function for functions.php

/**
* @desc Register WooCommmerce Product Attributes with Polylang
* @author woomultilingual.com
*/
add_action( 'init', 'woomulti_register_product_attributes', 11, 2  );
function woomulti_register_product_attributes() {
   // Global variables to interact with both Polylang and WooCommerce
   global $polylang, $woocommerce;
   // Quit if Polylang or WooCommerce are not activated and ready
   if ( !$polylang || !$woocommerce ) {
      return false;
   }
   // Get the product attributes from WooCommerce
   $product_attributes = wc_get_attribute_taxonomies();
   // In Polylang Settings - String Translation you can group entries
   $group = __( 'Product Attributes' );
   // Get taxonomies already ready for translation by Polylang
   $taxonomies = $polylang->model->get_translated_taxonomies();
   // Create array to hold all product attributes as WooCommerce taxonomies
   $attributes = array();
   foreach ( $product_attributes as $product_attribute ) {
   // Each product attribute label will be registered as a string in Polylang
      pll_register_string ( $product_attribute->attribute_label, $product_attribute->attribute_label, $group );
      //Add each attribute name (not the label) to the taxonomies array and adding "pa_" in front
      $attributes[] = substr_replace( $product_attribute->attribute_name, 'pa_', 0, 0);
   }
   // Merge the product attributes with the existing taxonomies
   $taxonomies = array_merge ( $taxonomies, $attributes );
   // Adding array to Polylang's filter 'pll_get_taxonomies' so its values are available for translation
   add_filter( 'pll_get_taxonomies', function () use ( $taxonomies ) { return $taxonomies; } );
}
add_filter( 'woocommerce_attribute_label', 'woomulti_translate_attribute_label' );
function woomulti_translate_attribute_label ( $label ) {
   return pll__( $label );
}

WooCommerce

Product Attributes

Polylang - Strings translation

 

WooCommerce

Product Attributes

Activate taxonomies

 

WooCommerce

Product Attributes

Configuring Terms

 

WooCommerce

Product Attributes

Translating each term

 

WooCommerce

Product Attributes

Select attribute - WooCommerce product

 

WooCommerce

Product Attributes

Product variations on frontend

 

WooCommerce

Product Attributes

YITH Ajax Product Filter Widget

 

WooCommerce

Product Attributes

YITH Ajax Product Filter Widget - Frontend

 

Questions?

Twitter

@woomultilingual

Easy to Understand Website Reports with WordPress, Google Analytics & Google Sheets

By onedaywebsite

Easy to Understand Website Reports with WordPress, Google Analytics & Google Sheets

Easy to Understand Website Reports with WordPress, Google Analytics & Google Sheets

  • 917