Skip to content

Commit

Permalink
Readme added, rename to conversion tracking, composer init
Browse files Browse the repository at this point in the history
  • Loading branch information
Antti Kuosmanen committed Nov 30, 2015
1 parent 75b85fa commit 45e1309
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.gitkeep
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "anttiviljami/wc-fb-conversion-tracking",
"description": "Set up the Facebook conversion pixel and event tracking for WooCommerce",
"type": "wordpress-plugin",
"license": "GPLv3",
"authors": [
{
"name": "Antti Kuosmanen",
"email": "[email protected]"
}
],
"require": {}
}
Empty file added lang/.gitkeep
Empty file.
33 changes: 33 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
=== WooCommerce Facebook Conversion Tracking ===
Contributors: Zuige
Tags: Woocommerce, Facebook, Conversion, Tracking, Pixel, Events
Donate link: https://seravo.fi/
Requires at least: 4.3.1
Tested up to: 4.4
Stable tag: 0.1
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

== Description ==

Set up the Facebook conversion pixel and event tracking for WooCommerce

== Installation ==

1. Upload plugin to the `/wp-content/plugins/` directory.
2. Activate the plugin through the "Plugins" menu in WordPress.
3. Installation done!

== Frequently Asked Questions ==

None yet.

== Screenshots ==

None yet.

== Changelog ==

Note that complete commit log is available at https://github.com/anttiviljami/wc-fb-conversion-tracking/commits/master

== Upgrade Notice ==
34 changes: 17 additions & 17 deletions wc-fb-pixel-events.php → wc-fb-conversion-tracking.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Plugin name: WooCommerce Facebook Pixel Events
* Plugin URI: https://github.com/Seravo/woocommerce-facebook-pixel-events
* Plugin name: WooCommerce Facebook Conversion Tracking
* Plugin URI: https://github.com/anttiviljami/wc-fb-conversion-tracking
* Description: Set up the Facebook conversion pixel and event tracking for WooCommerce
* Version: 0.1
* Author: Seravo Oy
* Author: http://seravo.fi
* License: GPLv3
* Text Domain: wc-fb-pixel-events
* Text Domain: wc-fb-conversion-tracking
*/

/** Copyright 2015 Seravo Oy
Expand All @@ -23,15 +23,15 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

if (!class_exists('WooCommerce_Facebook_Pixel_Events')) {
class WooCommerce_Facebook_Pixel_Events {
if (!class_exists('WooCommerce_Facebook_Conversion_Tracking')) {
class WooCommerce_Facebook_Conversion_Tracking {
public static $instance;

private $fbid = false; // this is wehere we store the tracking id

public static function init() {
if ( is_null( self::$instance ) ) {
self::$instance = new WooCommerce_Facebook_Pixel_Events();
self::$instance = new WooCommerce_Facebook_Conversion_Tracking();
}
return self::$instance;
}
Expand All @@ -42,8 +42,8 @@ private function __construct() {

// add WooCommerce settings tab page
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_tab' ), 50 );
add_action( 'woocommerce_settings_tabs_fb_events', array( $this, 'settings_tab' ) );
add_action( 'woocommerce_update_options_fb_events', array( $this, 'update_settings' ) );
add_action( 'woocommerce_settings_tabs_fb_tracking', array( $this, 'settings_tab' ) );
add_action( 'woocommerce_update_options_fb_tracking', array( $this, 'update_settings' ) );

// add the tracking pixel to all pages in the frontend
add_action( 'wp_head', array( $this, 'fb_tracking_pixel') );
Expand All @@ -53,38 +53,38 @@ private function __construct() {
* Load our plugin textdomain
*/
public static function load_our_textdomain() {
load_plugin_textdomain( 'wc-fb-pixel-events', false, dirname( plugin_basename(__FILE__) ) . '/lang/' );
load_plugin_textdomain( 'wc-fb-conversion-tracking', false, dirname( plugin_basename(__FILE__) ) . '/lang/' );
}

/**
* Add a WooCommerce Settings tab for plugin settings
*/
public static function add_settings_tab( $settings_tabs ) {
$settings_tabs['fb_events'] = __( 'Facebook', 'wc-fb-pixel-events' );
$settings_tabs['fb_tracking'] = __( 'Facebook', 'wc-fb-conversion-tracking' );
return $settings_tabs;
}

/**
* User configurable settings
*/
public static function get_settings() {
return apply_filters( 'wc_settings_tab_fb_events', array(
return apply_filters( 'wc_settings_tab_fb_tracking', array(
'section_title' => array(
'name' => __( 'Facebook Conversion Pixel', 'wc-fb-pixel-events' ),
'name' => __( 'Facebook Conversion Pixel', 'wc-fb-conversion-tracking' ),
'type' => 'title',
'desc' => '',
'id' => 'wc_settings_fb_events_section_title'
'id' => 'wc_settings_fb_tracking_section_title'
),
'title' => array(
'name' => __( 'Facebook Pixel ID', 'wc-fb-pixel-events' ),
'name' => __( 'Facebook Pixel ID', 'wc-fb-conversion-tracking' ),
'type' => 'text',
'desc' => __( "The numerical unique ID from your Facebook Pixel Tracking Code. Copied from this line: <code>fbq('init', '&lt;your ID&gt;');</code>", 'wc-fb-pixel-events' ),
'desc' => __( "The numerical unique ID from your Facebook Pixel Tracking Code. Copied from this line: <code>fbq('init', '&lt;your ID&gt;');</code>", 'wc-fb-conversion-tracking' ),
'placeholder' => '123456789',
'id' => 'wc_settings_fbid'
),
'section_end' => array(
'type' => 'sectionend',
'id' => 'wc_settings_fb_events_section_end'
'id' => 'wc_settings_fb_tracking_section_end'
)
) );
}
Expand Down Expand Up @@ -132,5 +132,5 @@ public function fb_tracking_pixel() {
}

// init the plugin
$woocommerce_facebook_pixel_events = WooCommerce_Facebook_Pixel_Events::init();
$woocommerce_facebook_conversion_tracking = WooCommerce_Facebook_Conversion_Tracking::init();

0 comments on commit 45e1309

Please sign in to comment.