Version Description
- Update: Implemented a much better workaround tor the CDATA issue
- Update: Implemented the new currency field
- Fix: Corrected the missing slash dot after the order value
Download this release
Release Info
Developer | alekv |
Plugin | Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more |
Version | 0.1.9 |
Comparing to | |
See all releases |
Code changes from version 0.1.1 to 0.1.9
- readme.txt +39 -8
- wgact.php +110 -92
readme.txt
CHANGED
@@ -1,34 +1,65 @@
|
|
1 |
=== Plugin Name ===
|
2 |
Contributors: alekv
|
3 |
Donate link: http://www.wolfundbaer.ch/donations/
|
4 |
-
Tags: WooCommerce, Google AdWords, conversion tag, conversion value tracking
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 0.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
This plugin inserts a Google AdWords conversion tracking tag into the thankyou page of a WooCommerce shop,
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
This plugin
|
16 |
|
17 |
== Installation ==
|
18 |
|
19 |
1. Upload the wgact plugin directory into your `/wp-content/plugins/` directory
|
20 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
21 |
-
3.
|
|
|
|
|
|
|
|
|
22 |
|
23 |
== Frequently Asked Questions ==
|
24 |
|
|
|
|
|
|
|
|
|
25 |
= Where can I report a bug or suggest improvements? =
|
26 |
|
27 |
-
Please
|
|
|
28 |
|
29 |
== Screenshots ==
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 0.1 =
|
34 |
* This is the initial release of the plugin. There are no known bugs so far.
|
1 |
=== Plugin Name ===
|
2 |
Contributors: alekv
|
3 |
Donate link: http://www.wolfundbaer.ch/donations/
|
4 |
+
Tags: WooCommerce, Google AdWords, conversion tag, conversion value tracking, conversion tracking
|
5 |
+
Requires at least: 3.1
|
6 |
+
Tested up to: 4.01
|
7 |
+
Stable tag: 0.1.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
This plugin inserts a Google AdWords conversion tracking tag into the thankyou page of a WooCommerce shop, dynamically measuring the conversion value.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
This plugin enables Google AdWords conversion value tracking for WooCommerce orders. This is important if you want to measure the ROI of your campaigns.
|
16 |
|
17 |
== Installation ==
|
18 |
|
19 |
1. Upload the wgact plugin directory into your `/wp-content/plugins/` directory
|
20 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
21 |
+
3. Get the AdWords conversion ID and the conversion label. You will find both values in the AdWords conversion tracking code.
|
22 |
+
4. In the WordpPress admin panel go to settings and then into the WGACT Plugin Menu. Please enter the conversion ID and the conversion label into their respective fields.
|
23 |
+
5. Delete any other instances of the AdWords tracking code which tracks sales. (You might have several AdWords tracking codes, eg. tracking newsletter applications. Keep those.)
|
24 |
+
6. Delete the cache on your server and on your browser.
|
25 |
+
7. Check if the AdWords tag is running fine by placing a test order (ideally click on one of your AdWords ads first) and then check with the Google Tag Assistang browser plugin if the tag has been inserted corretly on the thank you page.
|
26 |
|
27 |
== Frequently Asked Questions ==
|
28 |
|
29 |
+
= How do I check if the plugin is working properly? =
|
30 |
+
|
31 |
+
Download the Google Tag Assistant browser plugin. It is a powerful tool to validate all Google tags on your pages.
|
32 |
+
|
33 |
= Where can I report a bug or suggest improvements? =
|
34 |
|
35 |
+
Please post your problem in the WGACT Support forum: http://wordpress.org/support/plugin/woocommerce-google-adwords-conversion-tracking-tag
|
36 |
+
You can send the link to the front page of your shop too if you think it would be of help.
|
37 |
|
38 |
== Screenshots ==
|
39 |
|
40 |
== Changelog ==
|
41 |
|
42 |
+
= 0.1.9 =
|
43 |
+
* Update: Implemented a much better workaround tor the CDATA issue
|
44 |
+
* Update: Implemented the new currency field
|
45 |
+
* Fix: Corrected the missing slash dot after the order value
|
46 |
+
= 0.1.8 =
|
47 |
+
* Fix: Corrected the plugin source to prevent an error during activation
|
48 |
+
= 0.1.7 =
|
49 |
+
* Significantly improved the database access to evaluate the order value.
|
50 |
+
= 0.1.6 =
|
51 |
+
* Added some PHP code to the tracking tag as recommended by Google.
|
52 |
+
= 0.1.5 =
|
53 |
+
* Added settings field to the plugin page.
|
54 |
+
* Visual improvements to the options page.
|
55 |
+
= 0.1.4 =
|
56 |
+
* Changed the woo_foot hook to wp_footer to avoid problems with some themes. This should be more compatible with most themes as long as they use the wp_footer hook.
|
57 |
+
= 0.1.3 =
|
58 |
+
* Changed conversion language to 'en'.
|
59 |
+
= 0.1.2 =
|
60 |
+
* Disabled the check if WooCommerce is running. The check doesn't work properly with multisite WP installations, though the plugin does work with the multisite feature turned on.
|
61 |
+
* Added more description in the code to explain why I've build a workaround to not place the tracking code into the thankyou template of WC.
|
62 |
+
= 0.1.1 =
|
63 |
+
* Some minor changes to the code
|
64 |
= 0.1 =
|
65 |
* This is the initial release of the plugin. There are no known bugs so far.
|
wgact.php
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/*********************************************************************************************************************************************************************************************************************************
|
4 |
|
5 |
Plugin Name: WooCommerce Google AdWords conversion tracking tag
|
6 |
Plugin URI: http://www.wolfundbaer.ch
|
7 |
-
Description: This plugin
|
8 |
-
Version: 0.1.
|
9 |
Author: Wolf & Bär
|
10 |
Author URI: http://www.wolfundbaer.ch
|
11 |
|
@@ -15,64 +14,110 @@ Author URI: http://www.wolfundbaer.ch
|
|
15 |
class WGACT{
|
16 |
|
17 |
public function __construct(){
|
18 |
-
|
19 |
-
// check if WooCommerce is installed.
|
20 |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
21 |
|
22 |
// insert the tracking code into the footer of the WooCommerce page
|
|
|
|
|
23 |
add_action( 'woo_foot', array( $this, 'GoogleAdWordsTag' ));
|
|
|
24 |
}
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
// add the admin options page
|
28 |
add_action('admin_menu', array( $this, 'wgact_plugin_admin_add_page'));
|
29 |
|
30 |
// install a settings page in the admin console
|
31 |
add_action('admin_init', array( $this, 'wgact_plugin_admin_init'));
|
|
|
|
|
|
|
32 |
|
33 |
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
// add the admin options page
|
38 |
function wgact_plugin_admin_add_page() {
|
39 |
add_options_page('WGACT Plugin Page', 'WGACT Plugin Menu', 'manage_options', 'do_wgact', array($this, 'wgact_plugin_options_page'));
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
|
44 |
// display the admin options page
|
45 |
function wgact_plugin_options_page() {
|
46 |
|
47 |
-
// Throw a warning if WooCommerce is disabled.
|
|
|
48 |
if (! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
49 |
-
|
50 |
echo '<div><h1><font color="red"><b>WooCommerce not active -> tag insertion disabled !</b></font></h1></div>';
|
51 |
}
|
52 |
-
|
|
|
53 |
?>
|
54 |
-
<div>
|
55 |
-
<h2>WooCommerce Google AdWords conversion tracking tag</h2>
|
56 |
-
|
57 |
|
|
|
|
|
|
|
58 |
<form action="options.php" method="post">
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
<input type="hidden" name="hosted_button_id" value="UE3D2AW8YTML8">
|
72 |
-
<input type="image" src="https://www.paypalobjects.com/en_US/CH/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
73 |
-
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
74 |
</form>
|
|
|
|
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
<?php
|
78 |
|
@@ -81,16 +126,13 @@ class WGACT{
|
|
81 |
|
82 |
|
83 |
// add the admin settings and such
|
84 |
-
|
85 |
function wgact_plugin_admin_init(){
|
86 |
//register_setting( 'plugin_options', 'plugin_options', 'wgact_plugin_options_validate' );
|
87 |
register_setting( 'wgact_plugin_options', 'wgact_plugin_options_1');
|
88 |
register_setting( 'wgact_plugin_options', 'wgact_plugin_options_2');
|
89 |
-
// register_setting( 'wgact_plugin_options', 'wgact_plugin_options_3');
|
90 |
add_settings_section('wgact_plugin_main', 'WGACT Main Settings', array($this,'wgact_plugin_section_text'), 'do_wgact');
|
91 |
add_settings_field('wgact_plugin_text_string_1', 'Conversion ID', array($this,'wgact_plugin_setting_string_1'), 'do_wgact', 'wgact_plugin_main');
|
92 |
-
add_settings_field('wgact_plugin_text_string_2', 'Conversion label', array($this,'wgact_plugin_setting_string_2'), 'do_wgact', 'wgact_plugin_main');
|
93 |
-
// add_settings_field('wgact_plugin_text_string_3', 'Google Merchant Center prefix', 'wgact_plugin_setting_string_3', 'do_wgact', 'wgact_plugin_main');
|
94 |
}
|
95 |
|
96 |
function wgact_plugin_section_text() {
|
@@ -130,91 +172,67 @@ class WGACT{
|
|
130 |
return $newinput;
|
131 |
}
|
132 |
|
133 |
-
// just a test to find out the difference between plubic and private functions
|
134 |
-
public function testecho(){
|
135 |
-
|
136 |
-
echo 'testecho';
|
137 |
-
}
|
138 |
-
|
139 |
private function get_conversion_id(){
|
140 |
-
|
141 |
$opt = get_option('wgact_plugin_options_1');
|
142 |
$conversion_id = $opt['text_string'];
|
143 |
return $conversion_id;
|
144 |
}
|
145 |
|
146 |
private function get_conversion_label(){
|
147 |
-
|
148 |
$opt = get_option('wgact_plugin_options_2');
|
149 |
$conversion_label = $opt['text_string'];
|
150 |
return $conversion_label;
|
151 |
}
|
152 |
|
153 |
private function get_mc_prefix(){
|
154 |
-
|
155 |
$opt = get_option('wgact_plugin_options_3');
|
156 |
$mc_prefix = $opt['text_string'];
|
157 |
return $mc_prefix;
|
158 |
}
|
159 |
|
160 |
-
|
161 |
-
public function GoogleAdWordsTag() {
|
162 |
-
|
163 |
-
global $woocommerce;
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
185 |
|
186 |
-
$order = new WC_order($recent_order_id);
|
187 |
-
$order_total = $order->get_total();
|
188 |
-
|
189 |
?>
|
190 |
-
|
191 |
-
<!-- Google Code for Sales (AdWords) Conversion Page -->
|
192 |
-
<!-- inserted by the WGACT WooCommerce plugin developed by http://www.wolfundbaer.ch -->
|
193 |
-
|
194 |
-
<script type="text/javascript">
|
195 |
-
/* <![CDATA[ */
|
196 |
-
var google_conversion_id = <?php echo $conversion_id; ?>;
|
197 |
-
var google_conversion_language = "de";
|
198 |
-
var google_conversion_format = "2";
|
199 |
-
var google_conversion_color = "ffffff";
|
200 |
-
var google_conversion_label = "<?php echo $conversion_label; ?>";
|
201 |
-
var google_conversion_value = <?php echo $order_total; ?>;
|
202 |
-
/* ]]> */
|
203 |
-
</script>
|
204 |
-
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
|
205 |
-
</script>
|
206 |
-
<noscript>
|
207 |
-
<div style="display:inline;">
|
208 |
-
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/<?php echo $conversion_id; ?>/?value=<?php echo $order_total; ?>&label=<?php echo $conversion_label; ?>&guid=ON&script=0"/>
|
209 |
-
</div>
|
210 |
-
</noscript>
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
<?php
|
214 |
|
215 |
-
}
|
216 |
}
|
217 |
-
|
218 |
}
|
219 |
|
220 |
$wgact = new WGACT();
|
1 |
<?php
|
|
|
2 |
/*********************************************************************************************************************************************************************************************************************************
|
3 |
|
4 |
Plugin Name: WooCommerce Google AdWords conversion tracking tag
|
5 |
Plugin URI: http://www.wolfundbaer.ch
|
6 |
+
Description: This plugin enables Google AdWords conversion value tracking for WooCommerce orders. This is important if you want to measure the ROI or your campaigns.
|
7 |
+
Version: 0.1.9
|
8 |
Author: Wolf & Bär
|
9 |
Author URI: http://www.wolfundbaer.ch
|
10 |
|
14 |
class WGACT{
|
15 |
|
16 |
public function __construct(){
|
17 |
+
/*
|
18 |
+
// check if WooCommerce is installed. CHECK DISABLED because it doesn't work properly when the multisite feature is turned on in WP
|
19 |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
20 |
|
21 |
// insert the tracking code into the footer of the WooCommerce page
|
22 |
+
|
23 |
+
// using the woo_foot hook leads to problems with some themes. using wp_footer instead should solve it for all themes, as long as they use the standard wp_footer hook
|
24 |
add_action( 'woo_foot', array( $this, 'GoogleAdWordsTag' ));
|
25 |
+
add_action( 'wp_footer', array( $this, 'GoogleAdWordsTag' ));
|
26 |
}
|
27 |
+
*/
|
28 |
+
|
29 |
+
/**
|
30 |
+
You might ask yourself why I am inserting the following function.
|
31 |
+
A bit more information on that: Unfortunately there is a filter in WordPress (up to the current version 3.8.1) which messes up the Google AdWords tracking tag after injecting it into the thankyou page. The following function will fix this and is only a workaround until WordPress releases a fix. Accolaeds to awezlzel who posted this workaround. This bug was reported years ago and is still an open issue: http://core.trac.wordpress.org/ticket/3670
|
32 |
+
**/
|
33 |
+
|
34 |
+
function cdata_markupfix($content) { $content = str_replace("]]>", "]]>", $content); return $content; }
|
35 |
+
function cdata_template_redirect( $content ) { ob_start('cdata_markupfix'); }
|
36 |
+
add_action('template_redirect','cdata_template_redirect',-1);
|
37 |
+
|
38 |
+
// add the Google AdWords tag to the footer of the page
|
39 |
+
//add_action( 'wp_head', array( $this, 'GoogleAdWordsTag' ));
|
40 |
+
|
41 |
+
// add the Google AdWords tag to the thankyou part of the page within the body tags
|
42 |
+
add_action( 'woocommerce_thankyou', array( $this, 'GoogleAdWordsTag' ));
|
43 |
|
44 |
// add the admin options page
|
45 |
add_action('admin_menu', array( $this, 'wgact_plugin_admin_add_page'));
|
46 |
|
47 |
// install a settings page in the admin console
|
48 |
add_action('admin_init', array( $this, 'wgact_plugin_admin_init'));
|
49 |
+
|
50 |
+
// add a settings link on the plugins page
|
51 |
+
add_filter('plugin_action_links', array($this, 'wgact_settings_link'), 10, 2);
|
52 |
|
53 |
|
54 |
}
|
55 |
|
56 |
+
// adds a link on the plugins page for the wgact settings
|
57 |
+
function wgact_settings_link($links, $file) {
|
58 |
+
if ($file == plugin_basename(__FILE__))
|
59 |
+
$links[] = '<a href="' . admin_url("options-general.php?page=do_wgact") . '">'. __('Settings') .'</a>';
|
60 |
+
return $links;
|
61 |
+
}
|
62 |
|
63 |
// add the admin options page
|
64 |
function wgact_plugin_admin_add_page() {
|
65 |
add_options_page('WGACT Plugin Page', 'WGACT Plugin Menu', 'manage_options', 'do_wgact', array($this, 'wgact_plugin_options_page'));
|
66 |
}
|
67 |
|
|
|
|
|
68 |
// display the admin options page
|
69 |
function wgact_plugin_options_page() {
|
70 |
|
71 |
+
// Throw a warning if WooCommerce is disabled. CHECK DISABLED because it doesn't work properly when the multisite feature is turned on in WP
|
72 |
+
/*
|
73 |
if (! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
|
|
74 |
echo '<div><h1><font color="red"><b>WooCommerce not active -> tag insertion disabled !</b></font></h1></div>';
|
75 |
}
|
76 |
+
*/
|
77 |
+
|
78 |
?>
|
|
|
|
|
|
|
79 |
|
80 |
+
<br>
|
81 |
+
<div style="background: #eee; width: 772px">
|
82 |
+
<div style="background: #ccc; padding: 10px; font-weight: bold">Configuration for the WooCommerce Google AdWords conversion tracking tag</div>
|
83 |
<form action="options.php" method="post">
|
84 |
+
|
85 |
+
<?php settings_fields('wgact_plugin_options'); ?>
|
86 |
+
<?php do_settings_sections('do_wgact'); ?>
|
87 |
+
<br>
|
88 |
+
<table class="form-table" style="margin: 10px">
|
89 |
+
<tr>
|
90 |
+
<th scope="row" style="white-space: nowrap">
|
91 |
+
<input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" class="button" />
|
92 |
+
</th>
|
93 |
+
|
94 |
+
</tr>
|
95 |
+
</table>
|
|
|
|
|
|
|
96 |
</form>
|
97 |
+
|
98 |
+
</div>
|
99 |
|
100 |
+
<br>
|
101 |
+
|
102 |
+
<div style="background: #eee; width: 772px">
|
103 |
+
<div style="background: #ccc; padding: 10px; font-weight: bold">Donation</div>
|
104 |
+
|
105 |
+
<table class="form-table" style="margin: 10px">
|
106 |
+
<tr>
|
107 |
+
<th scope="row">
|
108 |
+
<div style="padding: 10px">This plugin was developed by <a href="http://www.wolfundbaer.ch" target="_blank">Wolf & Bär</a><p>Buy me a beer if you like the plugin.<br>
|
109 |
+
If you want me to continue developing the plugin buy me a few more beers. Although, I probably will continue to develop the plugin anyway. It would be just much more fun if I had a few beers to celebrate my milestones.</div>
|
110 |
+
|
111 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
112 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
113 |
+
<input type="hidden" name="hosted_button_id" value="UE3D2AW8YTML8">
|
114 |
+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
115 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
116 |
+
</form>
|
117 |
+
</th>
|
118 |
+
</tr>
|
119 |
+
</table>
|
120 |
+
</div>
|
121 |
|
122 |
<?php
|
123 |
|
126 |
|
127 |
|
128 |
// add the admin settings and such
|
|
|
129 |
function wgact_plugin_admin_init(){
|
130 |
//register_setting( 'plugin_options', 'plugin_options', 'wgact_plugin_options_validate' );
|
131 |
register_setting( 'wgact_plugin_options', 'wgact_plugin_options_1');
|
132 |
register_setting( 'wgact_plugin_options', 'wgact_plugin_options_2');
|
|
|
133 |
add_settings_section('wgact_plugin_main', 'WGACT Main Settings', array($this,'wgact_plugin_section_text'), 'do_wgact');
|
134 |
add_settings_field('wgact_plugin_text_string_1', 'Conversion ID', array($this,'wgact_plugin_setting_string_1'), 'do_wgact', 'wgact_plugin_main');
|
135 |
+
add_settings_field('wgact_plugin_text_string_2', 'Conversion label', array($this,'wgact_plugin_setting_string_2'), 'do_wgact', 'wgact_plugin_main');
|
|
|
136 |
}
|
137 |
|
138 |
function wgact_plugin_section_text() {
|
172 |
return $newinput;
|
173 |
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
private function get_conversion_id(){
|
|
|
176 |
$opt = get_option('wgact_plugin_options_1');
|
177 |
$conversion_id = $opt['text_string'];
|
178 |
return $conversion_id;
|
179 |
}
|
180 |
|
181 |
private function get_conversion_label(){
|
|
|
182 |
$opt = get_option('wgact_plugin_options_2');
|
183 |
$conversion_label = $opt['text_string'];
|
184 |
return $conversion_label;
|
185 |
}
|
186 |
|
187 |
private function get_mc_prefix(){
|
|
|
188 |
$opt = get_option('wgact_plugin_options_3');
|
189 |
$mc_prefix = $opt['text_string'];
|
190 |
return $mc_prefix;
|
191 |
}
|
192 |
|
193 |
+
// insert the Google AdWords tag into the page
|
194 |
+
public function GoogleAdWordsTag($order_id) {
|
|
|
|
|
195 |
|
196 |
+
$conversion_id = $this->get_conversion_id();
|
197 |
+
$conversion_label = $this->get_conversion_label();
|
198 |
+
$mc_prefix = $this->get_mc_prefix();
|
199 |
+
|
200 |
+
// get order from URL and evaluate order total
|
201 |
+
$order = new WC_Order( $order_id );
|
202 |
+
$order_total = $order->get_total();
|
203 |
+
?>
|
|
|
204 |
|
205 |
+
<!-- Google Code for Sales (AdWords) Conversion Page -->
|
206 |
+
<script type="text/javascript">
|
207 |
+
/* <![CDATA[ */
|
208 |
+
var google_conversion_id = <?php echo $conversion_id; ?>;
|
209 |
+
var google_conversion_language = "en";
|
210 |
+
var google_conversion_format = "3";
|
211 |
+
var google_conversion_color = "ffffff";
|
212 |
+
var google_conversion_label = "<?php echo $conversion_label; ?>";
|
213 |
+
<?php
|
214 |
+
|
215 |
+
if ( $order_total ) {
|
216 |
+
echo "var google_conversion_value = " . $order_total . ";";
|
217 |
+
}
|
218 |
|
|
|
|
|
|
|
219 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
+
var google_conversion_currency = "<?php echo $order->get_order_currency(); ?>";
|
222 |
+
var google_remarketing_only = false;
|
223 |
+
/* ]]> */
|
224 |
+
</script>
|
225 |
+
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
|
226 |
+
</script>
|
227 |
+
<noscript>
|
228 |
+
<div style="display:inline;">
|
229 |
+
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/<?php echo $conversion_id; ?>/?value=<?php echo $order_total; ?>&currency_code=<?php echo $order->get_order_currency(); ?>&label=<?php echo $conversion_label; ?>&guid=ON&script=0"/>
|
230 |
+
</div>
|
231 |
+
</noscript>
|
232 |
|
233 |
+
<?php
|
234 |
|
|
|
235 |
}
|
|
|
236 |
}
|
237 |
|
238 |
$wgact = new WGACT();
|