Version Description
- 05/04/2022 =
- New: Facebook Pixel conversion tracking for major ecommerce events like Page view, Add to Cart, Initiate checkout, Purchase, View Content and Search events.
- New: Compatible with Multi Currency plugins like "WOOCS", "CURCY Multi-Currency for WooCommerce" and "WBW Currency Switcher for WooCommerce"
Download this release
Release Info
Developer | ramniktatvic |
Plugin | Enhanced Ecommerce Google Analytics Plugin for WooCommerce |
Version | 4.7.0 |
Comparing to | |
See all releases |
Code changes from version 4.6.9 to 4.7.0
- admin/class-conversios-admin.php +43 -41
- admin/class-enhanced-ecommerce-google-analytics-admin.php +22 -0
- admin/class-tvc-admin-helper.php +9 -0
- admin/css/style.css +9 -3
- admin/helper/class-onboarding-helper.php +7 -69
- admin/images/fb-icon.png +0 -0
- admin/images/fb-pixel.jpg +0 -0
- admin/images/icon-dashboard.jpg +0 -0
- admin/images/rate-us.png +0 -0
- admin/images/rate-us1.png +0 -0
- admin/partials/class-conversios-footer.php +5 -1
- admin/partials/class-conversios-header.php +51 -31
- admin/partials/general-fields.php +35 -1
- enhanced-ecommerce-google-analytics.php +3 -3
- includes/class-enhanced-ecommerce-google-analytics-activator.php +2 -0
- includes/class-enhanced-ecommerce-google-analytics-deactivator.php +4 -1
- includes/class-enhanced-ecommerce-google-analytics.php +11 -8
- includes/setup/CustomApi.php +47 -9
- includes/setup/google-ads.php +7 -1
- public/class-enhanced-ecommerce-google-analytics-public-pro.php +83 -64
- public/class-enhanced-ecommerce-google-analytics-public.php +150 -17
- public/js/tvc-ee-google-analytics.js +184 -40
- readme.txt +13 -6
admin/class-conversios-admin.php
CHANGED
@@ -109,55 +109,57 @@ if ( ! class_exists( 'Conversios_Admin' ) ) {
|
|
109 |
add_menu_page(
|
110 |
esc_html__('Tatvic EE Plugin','conversios'), esc_html__('Tatvic EE Plugin','conversios'), 'manage_options', "conversios", array($this, 'showPage'), esc_url_raw(plugin_dir_url(__FILE__) . 'images/tatvic_logo.png'), 26
|
111 |
);
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
135 |
'conversios',
|
136 |
-
esc_html__('
|
137 |
-
esc_html__('
|
138 |
'manage_options',
|
139 |
-
'conversios-google-
|
140 |
array($this, 'showPage')
|
141 |
-
|
142 |
-
|
143 |
-
'conversios',
|
144 |
-
esc_html__('Account Summary', 'conversios'),
|
145 |
-
esc_html__('Account Summary', 'conversios'),
|
146 |
-
'manage_options',
|
147 |
-
'conversios-account',
|
148 |
-
array($this, 'showPage')
|
149 |
-
);
|
150 |
-
if($plan_id == 1){
|
151 |
add_submenu_page(
|
152 |
'conversios',
|
153 |
-
esc_html__('
|
154 |
-
esc_html__('
|
155 |
'manage_options',
|
156 |
-
'conversios-
|
157 |
array($this, 'showPage')
|
158 |
);
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
|
163 |
/**
|
109 |
add_menu_page(
|
110 |
esc_html__('Tatvic EE Plugin','conversios'), esc_html__('Tatvic EE Plugin','conversios'), 'manage_options', "conversios", array($this, 'showPage'), esc_url_raw(plugin_dir_url(__FILE__) . 'images/tatvic_logo.png'), 26
|
111 |
);
|
112 |
+
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
113 |
+
add_submenu_page(
|
114 |
+
'conversios',
|
115 |
+
esc_html__('Dashboard','conversios'),
|
116 |
+
esc_html__('Dashboard','conversios'),
|
117 |
+
'manage_options',
|
118 |
+
'conversios' );
|
119 |
+
add_submenu_page(
|
120 |
+
'conversios',
|
121 |
+
esc_html__('Google Shopping', 'conversios'),
|
122 |
+
esc_html__('Google Shopping', 'conversios'),
|
123 |
+
'manage_options',
|
124 |
+
'conversios-google-shopping-feed',
|
125 |
+
array($this, 'showPage')
|
126 |
+
);
|
127 |
+
add_submenu_page(
|
128 |
+
'conversios',
|
129 |
+
esc_html__('Google Ads', 'conversios'),
|
130 |
+
esc_html__('Google Ads', 'conversios'),
|
131 |
+
'manage_options',
|
132 |
+
'conversios-google-ads',
|
133 |
+
array($this, 'showPage')
|
134 |
+
);
|
135 |
+
add_submenu_page(
|
136 |
'conversios',
|
137 |
+
esc_html__('Account Settings', 'conversios'),
|
138 |
+
esc_html__('Account Settings', 'conversios'),
|
139 |
'manage_options',
|
140 |
+
'conversios-google-analytics',
|
141 |
array($this, 'showPage')
|
142 |
+
);
|
143 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
add_submenu_page(
|
145 |
'conversios',
|
146 |
+
esc_html__('Account Summary', 'conversios'),
|
147 |
+
esc_html__('Account Summary', 'conversios'),
|
148 |
'manage_options',
|
149 |
+
'conversios-account',
|
150 |
array($this, 'showPage')
|
151 |
);
|
152 |
+
if($plan_id == 1){
|
153 |
+
add_submenu_page(
|
154 |
+
'conversios',
|
155 |
+
esc_html__('Free Vs Pro', 'conversios'),
|
156 |
+
esc_html__('Free Vs Pro', 'conversios'),
|
157 |
+
'manage_options',
|
158 |
+
'conversios-pricings',
|
159 |
+
array($this, 'showPage')
|
160 |
+
);
|
161 |
+
}
|
162 |
+
}
|
163 |
}
|
164 |
|
165 |
/**
|
admin/class-enhanced-ecommerce-google-analytics-admin.php
CHANGED
@@ -51,6 +51,7 @@ class Enhanced_Ecommerce_Google_Analytics_Admin extends TVC_Admin_Helper {
|
|
51 |
public function tvc_admin_notice(){
|
52 |
// add fixed message notification
|
53 |
//$this->add_tvc_fixed_nofification();
|
|
|
54 |
$ee_additional_data = $this->get_ee_additional_data();
|
55 |
if(isset($ee_additional_data['dismissed_ee_adimin_notic_a']) && $ee_additional_data['dismissed_ee_adimin_notic_a'] == 1){
|
56 |
}else{
|
@@ -80,6 +81,27 @@ class Enhanced_Ecommerce_Google_Analytics_Admin extends TVC_Admin_Helper {
|
|
80 |
</div>';
|
81 |
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
?>
|
84 |
<script>
|
85 |
var tvc_ajax_url = '<?php echo esc_url_raw(admin_url( 'admin-ajax.php' )); ?>';
|
51 |
public function tvc_admin_notice(){
|
52 |
// add fixed message notification
|
53 |
//$this->add_tvc_fixed_nofification();
|
54 |
+
$ee_settings = unserialize(get_option('ee_options'));
|
55 |
$ee_additional_data = $this->get_ee_additional_data();
|
56 |
if(isset($ee_additional_data['dismissed_ee_adimin_notic_a']) && $ee_additional_data['dismissed_ee_adimin_notic_a'] == 1){
|
57 |
}else{
|
81 |
</div>';
|
82 |
|
83 |
}
|
84 |
+
$fb_pixel_id = isset($ee_settings['fb_pixel_id'])?$ee_settings['fb_pixel_id']:"";
|
85 |
+
if(isset($ee_additional_data['dismissed_ee_adimin_notic_d']) && $ee_additional_data['dismissed_ee_adimin_notic_d'] == 1){
|
86 |
+
|
87 |
+
}else{
|
88 |
+
|
89 |
+
if($fb_pixel_id == ""){
|
90 |
+
echo '<div class="notice notice-info is-dismissible" data-id="ee_adimin_notic_d">
|
91 |
+
<img style="float: left; height: 45px;" src="'.esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/fb-pixel.jpg").'" ><p style="line-height: 28px; margin-left: 5px; display: inline-block;">'. esc_html__("Introducing the all-new Facebook Pixel Tracking in Conversios today!","conversios").' <a href="'.esc_url_raw('admin.php?page=conversios-google-analytics#fb_pixel_id').'"><b><u>'. esc_html__(" Check it out for yourself.","conversios").'</u></b></a></p>
|
92 |
+
</div>';
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
if(isset($ee_additional_data['dismissed_ee_adimin_notic_e']) && $ee_additional_data['dismissed_ee_adimin_notic_e'] == 1){
|
97 |
+
}else if(( isset($ee_additional_data['dismissed_ee_adimin_notic_d']) && $ee_additional_data['dismissed_ee_adimin_notic_d'] == 1) || $fb_pixel_id != ""){
|
98 |
+
$gm_id = isset($ee_settings['gm_id'])?$ee_settings['gm_id']:"";
|
99 |
+
if($gm_id != ""){
|
100 |
+
echo '<div class="notice notice-info is-dismissible" data-id="ee_adimin_notic_e">
|
101 |
+
<img style="float: left; height: 45px;" src="'.esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/icon-dashboard.jpg").'" ><p style="line-height: 28px; margin-left: 5px; display: inline-block;">'. esc_html__("Your GA4 Dashboard is just a click away !","conversios").' <a href="'.esc_url_raw('admin.php?page=conversios&ga_type=ga4').'"><b><u>'. esc_html__(" Go to GA4 Dashboard.","conversios").'</u></b></a></p>
|
102 |
+
</div>';
|
103 |
+
}
|
104 |
+
}
|
105 |
?>
|
106 |
<script>
|
107 |
var tvc_ajax_url = '<?php echo esc_url_raw(admin_url( 'admin-ajax.php' )); ?>';
|
admin/class-tvc-admin-helper.php
CHANGED
@@ -590,6 +590,12 @@ Class TVC_Admin_Helper{
|
|
590 |
}
|
591 |
/* start display form input*/
|
592 |
public function tvc_language_select($name, $class_id="", string $label="Please Select", string $sel_val = "en", bool $require = false){
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
if($name){
|
594 |
$countries_list = $this->get_gmc_language_list();
|
595 |
?>
|
@@ -897,6 +903,9 @@ Class TVC_Admin_Helper{
|
|
897 |
}
|
898 |
}
|
899 |
|
|
|
|
|
|
|
900 |
public function get_tvc_popup_message(){
|
901 |
return '<div id="tvc_popup_box">
|
902 |
<span class="close" id="tvc_close_msg" onclick="tvc_helper.tvc_close_msg()"> × </span>
|
590 |
}
|
591 |
/* start display form input*/
|
592 |
public function tvc_language_select($name, $class_id="", string $label="Please Select", string $sel_val = "en", bool $require = false){
|
593 |
+
if($sel_val == "en"){
|
594 |
+
$sel_val = get_locale();
|
595 |
+
if ( strlen( $sel_val ) > 0 ) {
|
596 |
+
$sel_val = explode( '_', $sel_val )[0];
|
597 |
+
}
|
598 |
+
}
|
599 |
if($name){
|
600 |
$countries_list = $this->get_gmc_language_list();
|
601 |
?>
|
903 |
}
|
904 |
}
|
905 |
|
906 |
+
public function update_app_status($status = "1"){
|
907 |
+
$this->customApiObj->update_app_status($status);
|
908 |
+
}
|
909 |
public function get_tvc_popup_message(){
|
910 |
return '<div id="tvc_popup_box">
|
911 |
<span class="close" id="tvc_close_msg" onclick="tvc_helper.tvc_close_msg()"> × </span>
|
admin/css/style.css
CHANGED
@@ -21,6 +21,15 @@
|
|
21 |
color: #002BFC;
|
22 |
border-bottom: 1px solid;
|
23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
/*dasboard*/
|
25 |
select#tvc_conversion_tracking_type{
|
26 |
border: 1px solid #C6C6C6;
|
@@ -47,8 +56,6 @@ select#tvc_conversion_tracking_type{
|
|
47 |
animation: shiny-btn1 5s ease-in-out infinite;
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
|
52 |
@-webkit-keyframes shiny-btn1 {
|
53 |
0% { -webkit-transform: scale(0) rotate(45deg); opacity: 0; }
|
54 |
40% { -webkit-transform: scale(0) rotate(45deg); opacity: 0.5; }
|
@@ -68,7 +75,6 @@ select#tvc_conversion_tracking_type{
|
|
68 |
100% { right:0%; }
|
69 |
|
70 |
}
|
71 |
-
|
72 |
.product_batch_size{position: relative; margin-top: 10px; float: right;}
|
73 |
.product_batch_size label{ margin-right: 23px;}
|
74 |
.update-nag, .updated, .error, .is-dismissible, .notice { display: none !important; }
|
21 |
color: #002BFC;
|
22 |
border-bottom: 1px solid;
|
23 |
}
|
24 |
+
.tvc_footer_links{display: block;}
|
25 |
+
.tvc-youtube-video{display: inline-block;}
|
26 |
+
.tvc-youtube-video span{display: block; margin-top: 22px; font-weight: 600;}
|
27 |
+
.tvc-youtube-video a{display: block; margin: 3px 5px 3px 10px;}
|
28 |
+
.rate_us{
|
29 |
+
margin-right: 37px;
|
30 |
+
display: inline-block; float: right;}
|
31 |
+
.rate_us span{margin-right: 3px; vertical-align: bottom;}
|
32 |
+
.rate_us img{max-width: 120px;}
|
33 |
/*dasboard*/
|
34 |
select#tvc_conversion_tracking_type{
|
35 |
border: 1px solid #C6C6C6;
|
56 |
animation: shiny-btn1 5s ease-in-out infinite;
|
57 |
}
|
58 |
|
|
|
|
|
59 |
@-webkit-keyframes shiny-btn1 {
|
60 |
0% { -webkit-transform: scale(0) rotate(45deg); opacity: 0; }
|
61 |
40% { -webkit-transform: scale(0) rotate(45deg); opacity: 0.5; }
|
75 |
100% { right:0%; }
|
76 |
|
77 |
}
|
|
|
78 |
.product_batch_size{position: relative; margin-top: 10px; float: right;}
|
79 |
.product_batch_size label{ margin-right: 23px;}
|
80 |
.update-nag, .updated, .error, .is-dismissible, .notice { display: none !important; }
|
admin/helper/class-onboarding-helper.php
CHANGED
@@ -81,16 +81,7 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
81 |
if($this->admin_safe_ajax_call($nonce, 'conversios_onboarding_nonce')){
|
82 |
$data = isset($_POST['tvc_data'])?sanitize_text_field($_POST['tvc_data']):"";
|
83 |
$tvc_data = json_decode(str_replace(""", "\"", $data));
|
84 |
-
$api_obj = new Conversios_Onboarding_ApiCall(sanitize_text_field($tvc_data->access_token), sanitize_text_field($tvc_data->refresh_token));
|
85 |
-
/*sendingblue*/
|
86 |
-
$data = array();
|
87 |
-
$data["email"] = $tvc_data->g_mail;
|
88 |
-
$data["attributes"]["PRODUCT"] = "Woocommerce Free Plugin";
|
89 |
-
$data["attributes"]["SET_GA"] = true;
|
90 |
-
$data["listIds"]=[40,41];
|
91 |
-
$data["updateEnabled"]=true;
|
92 |
-
$this->add_sendinblue_contant($data, $api_obj);
|
93 |
-
/*end sendingblue*/
|
94 |
echo json_encode($api_obj->saveAnalyticsData($_POST));
|
95 |
wp_die();
|
96 |
}else{
|
@@ -141,15 +132,6 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
141 |
$data = isset($_POST['tvc_data'])?sanitize_text_field($_POST['tvc_data']):"";
|
142 |
$tvc_data = json_decode(str_replace(""", "\"", $data));
|
143 |
$api_obj = new Conversios_Onboarding_ApiCall(sanitize_text_field($tvc_data->access_token), sanitize_text_field($tvc_data->refresh_token));
|
144 |
-
/*sendingblue*/
|
145 |
-
$data = array();
|
146 |
-
$data["email"] = sanitize_email($tvc_data->g_mail);
|
147 |
-
$data["attributes"]["PRODUCT"] = sanitize_text_field("Woocommerce Free Plugin");
|
148 |
-
$data["attributes"]["SET_ADS"] = true;
|
149 |
-
$data["listIds"]=[40,41];
|
150 |
-
$data["updateEnabled"]=true;
|
151 |
-
$this->add_sendinblue_contant($data, $api_obj);
|
152 |
-
/*end sendingblue*/
|
153 |
echo json_encode($api_obj->saveGoogleAdsData($_POST));
|
154 |
wp_die();
|
155 |
}else{
|
@@ -217,15 +199,6 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
217 |
$data = isset($_POST['tvc_data'])?sanitize_text_field($_POST['tvc_data']):"";
|
218 |
$tvc_data = json_decode(str_replace(""", "\"", $data));
|
219 |
$api_obj = new Conversios_Onboarding_ApiCall(sanitize_text_field($tvc_data->access_token), sanitize_text_field($tvc_data->refresh_token));
|
220 |
-
/*sendingblue*/
|
221 |
-
$data = array();
|
222 |
-
$data["email"] = sanitize_email($tvc_data->g_mail);
|
223 |
-
$data["attributes"]["PRODUCT"] = sanitize_text_field("Woocommerce Free Plugin");
|
224 |
-
$data["attributes"]["SET_GMC"] = true;
|
225 |
-
$data["listIds"]=[40,41];
|
226 |
-
$data["updateEnabled"]=true;
|
227 |
-
$this->add_sendinblue_contant($data, $api_obj);
|
228 |
-
/*end sendingblue*/
|
229 |
echo json_encode($api_obj->saveMechantData($_POST));
|
230 |
wp_die();
|
231 |
}else{
|
@@ -309,7 +282,7 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
309 |
* @since 4.0.2
|
310 |
*/
|
311 |
public function save_wp_setting_from_subscription_api($api_obj, $tvc_data, $subscription_id){
|
312 |
-
|
313 |
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
314 |
$google_detail = $api_obj->getSubscriptionDetails($tvc_data, $subscription_id);
|
315 |
/**
|
@@ -349,9 +322,10 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
349 |
$settings['ga_gUser'] = 'on';
|
350 |
$settings['ga_Impr'] = 6;
|
351 |
$settings['ga_IPA'] = 'on';
|
352 |
-
|
353 |
$settings['ga_PrivacyPolicy'] = 'on';
|
354 |
$settings['google-analytic'] = '';
|
|
|
355 |
//update option in wordpress local database
|
356 |
update_option('google_ads_conversion_tracking', $googleDetail->google_ads_conversion_tracking);
|
357 |
update_option('ads_tracking_id', $googleDetail->google_ads_id);
|
@@ -359,6 +333,7 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
359 |
update_option('ads_edrt', $googleDetail->dynamic_remarketing_tags);
|
360 |
|
361 |
$TVC_Admin_Helper->save_ee_options_settings($settings);
|
|
|
362 |
/*
|
363 |
* function call for save API data in WP DB
|
364 |
*/
|
@@ -450,15 +425,7 @@ if(!class_exists('Conversios_Onboarding_Helper')):
|
|
450 |
* function call for save API data in WP DB
|
451 |
*/
|
452 |
$TVC_Admin_Helper->set_update_api_to_db($googleDetail);
|
453 |
-
}
|
454 |
-
/**
|
455 |
-
* update contact details on sendinblue.
|
456 |
-
* @since 4.0.2
|
457 |
-
*/
|
458 |
-
function add_sendinblue_contant($data, $api_obj){
|
459 |
-
$api_obj->TVC_CALL_API_sendinblue("POST", "https://api.sendinblue.com/v3/contacts", $data);
|
460 |
-
}
|
461 |
-
|
462 |
}
|
463 |
endif; // class_exists
|
464 |
new Conversios_Onboarding_Helper();
|
@@ -501,36 +468,7 @@ if(!class_exists('Conversios_Onboarding_ApiCall') ){
|
|
501 |
return $e->getMessage();
|
502 |
}
|
503 |
}
|
504 |
-
|
505 |
-
try {
|
506 |
-
$args = array(
|
507 |
-
'headers' => array(
|
508 |
-
'api-key' => sanitize_text_field("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"),
|
509 |
-
'Content-Type' => 'application/json'
|
510 |
-
),
|
511 |
-
'method' => $method,
|
512 |
-
'body' => $data
|
513 |
-
);
|
514 |
-
// Send remote request
|
515 |
-
$request = wp_remote_post($url, $args);
|
516 |
-
// Retrieve information
|
517 |
-
$response_code = wp_remote_retrieve_response_code($request);
|
518 |
-
$response_message = wp_remote_retrieve_response_message($request);
|
519 |
-
$response_body = json_decode(wp_remote_retrieve_body($request));
|
520 |
-
|
521 |
-
if ((isset($response_body->error) && $response_body->error == '')) {
|
522 |
-
return new WP_REST_Response(
|
523 |
-
array('status' => $response_code, 'message' => $response_message, 'data' => $response_body->data)
|
524 |
-
);
|
525 |
-
} else {
|
526 |
-
return new WP_Error($response_code, $response_message, $response_body);
|
527 |
-
}
|
528 |
-
} catch (Exception $e) {
|
529 |
-
return $e->getMessage();
|
530 |
-
}
|
531 |
-
|
532 |
-
}
|
533 |
-
|
534 |
public function getSubscriptionDetails($tvc_data, $subscription_id){
|
535 |
try{
|
536 |
$tvc_data = (object)$tvc_data;
|
81 |
if($this->admin_safe_ajax_call($nonce, 'conversios_onboarding_nonce')){
|
82 |
$data = isset($_POST['tvc_data'])?sanitize_text_field($_POST['tvc_data']):"";
|
83 |
$tvc_data = json_decode(str_replace(""", "\"", $data));
|
84 |
+
$api_obj = new Conversios_Onboarding_ApiCall(sanitize_text_field($tvc_data->access_token), sanitize_text_field($tvc_data->refresh_token));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
echo json_encode($api_obj->saveAnalyticsData($_POST));
|
86 |
wp_die();
|
87 |
}else{
|
132 |
$data = isset($_POST['tvc_data'])?sanitize_text_field($_POST['tvc_data']):"";
|
133 |
$tvc_data = json_decode(str_replace(""", "\"", $data));
|
134 |
$api_obj = new Conversios_Onboarding_ApiCall(sanitize_text_field($tvc_data->access_token), sanitize_text_field($tvc_data->refresh_token));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
echo json_encode($api_obj->saveGoogleAdsData($_POST));
|
136 |
wp_die();
|
137 |
}else{
|
199 |
$data = isset($_POST['tvc_data'])?sanitize_text_field($_POST['tvc_data']):"";
|
200 |
$tvc_data = json_decode(str_replace(""", "\"", $data));
|
201 |
$api_obj = new Conversios_Onboarding_ApiCall(sanitize_text_field($tvc_data->access_token), sanitize_text_field($tvc_data->refresh_token));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
echo json_encode($api_obj->saveMechantData($_POST));
|
203 |
wp_die();
|
204 |
}else{
|
282 |
* @since 4.0.2
|
283 |
*/
|
284 |
public function save_wp_setting_from_subscription_api($api_obj, $tvc_data, $subscription_id){
|
285 |
+
$old_setting = unserialize(get_option('ee_options'));
|
286 |
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
287 |
$google_detail = $api_obj->getSubscriptionDetails($tvc_data, $subscription_id);
|
288 |
/**
|
322 |
$settings['ga_gUser'] = 'on';
|
323 |
$settings['ga_Impr'] = 6;
|
324 |
$settings['ga_IPA'] = 'on';
|
325 |
+
//$settings['ga_OPTOUT'] = 'on';
|
326 |
$settings['ga_PrivacyPolicy'] = 'on';
|
327 |
$settings['google-analytic'] = '';
|
328 |
+
$settings['fb_pixel_id'] = isset($old_setting['fb_pixel_id'])?$old_setting['fb_pixel_id']:"";
|
329 |
//update option in wordpress local database
|
330 |
update_option('google_ads_conversion_tracking', $googleDetail->google_ads_conversion_tracking);
|
331 |
update_option('ads_tracking_id', $googleDetail->google_ads_id);
|
333 |
update_option('ads_edrt', $googleDetail->dynamic_remarketing_tags);
|
334 |
|
335 |
$TVC_Admin_Helper->save_ee_options_settings($settings);
|
336 |
+
$TVC_Admin_Helper->update_app_status();
|
337 |
/*
|
338 |
* function call for save API data in WP DB
|
339 |
*/
|
425 |
* function call for save API data in WP DB
|
426 |
*/
|
427 |
$TVC_Admin_Helper->set_update_api_to_db($googleDetail);
|
428 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
}
|
430 |
endif; // class_exists
|
431 |
new Conversios_Onboarding_Helper();
|
468 |
return $e->getMessage();
|
469 |
}
|
470 |
}
|
471 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
public function getSubscriptionDetails($tvc_data, $subscription_id){
|
473 |
try{
|
474 |
$tvc_data = (object)$tvc_data;
|
admin/images/fb-icon.png
ADDED
Binary file
|
admin/images/fb-pixel.jpg
ADDED
Binary file
|
admin/images/icon-dashboard.jpg
ADDED
Binary file
|
admin/images/rate-us.png
ADDED
Binary file
|
admin/images/rate-us1.png
ADDED
Binary file
|
admin/partials/class-conversios-footer.php
CHANGED
@@ -9,7 +9,11 @@ if ( ! class_exists( 'Conversios_Footer' ) ) {
|
|
9 |
add_action('add_conversios_footer',array($this, 'before_end_footer'));
|
10 |
}
|
11 |
public function before_end_footer(){
|
12 |
-
?>
|
|
|
|
|
|
|
|
|
13 |
</div>
|
14 |
<?php
|
15 |
}
|
9 |
add_action('add_conversios_footer',array($this, 'before_end_footer'));
|
10 |
}
|
11 |
public function before_end_footer(){
|
12 |
+
?> <div class="tvc_footer_links">
|
13 |
+
<div class="rate_us">
|
14 |
+
<a href="https://wordpress.org/support/plugin/enhanced-e-commerce-for-woocommerce-store/reviews/?rate=5#rate-response" target="_blank"><span>Rate Us!</span><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/rate-us.png'); ?>" /></a>
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
</div>
|
18 |
<?php
|
19 |
}
|
admin/partials/class-conversios-header.php
CHANGED
@@ -39,29 +39,45 @@ if ( ! class_exists( 'Conversios_Header' ) ) {
|
|
39 |
* @since 4.1.4
|
40 |
*/
|
41 |
public function header_notices(){
|
42 |
-
if(
|
43 |
?>
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
<a target="_blank" href="<?php echo esc_url_raw($this->get_pro_plan_site().'?utm_source=EE+Plugin+User+Interface&utm_medium=Top+Bar+upgrading+to+pro&utm_campaign=Upsell+at+Conversios'); ?>" class="upgradebtn"><?php esc_html_e("Upgrade","conversios"); ?></a>
|
56 |
-
</div>
|
57 |
-
</div>
|
58 |
-
</div>
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
<!--- Promotion box end -->
|
62 |
<?php
|
63 |
-
}
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
/**
|
67 |
* header section
|
@@ -69,6 +85,7 @@ if ( ! class_exists( 'Conversios_Header' ) ) {
|
|
69 |
* @since 4.1.4
|
70 |
*/
|
71 |
public function conversios_header(){
|
|
|
72 |
$plan_name = esc_html__("Free Plan","conversios");
|
73 |
if(isset($this->subscription_data->plan_name) && !in_array($this->subscription_data->plan_id, array("1"))){
|
74 |
$plan_name = $this->subscription_data->plan_name;
|
@@ -110,16 +127,19 @@ if ( ! class_exists( 'Conversios_Header' ) ) {
|
|
110 |
}
|
111 |
public function conversios_menu_list(){
|
112 |
//slug => arra();
|
113 |
-
$conversios_menu_list = array(
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
123 |
if($this->plan_id == 1){
|
124 |
$conversios_menu_list['conversios-pricings'] = array('title'=>esc_html__('Free Vs Pro','conversios'),'icon'=>'');
|
125 |
}
|
39 |
* @since 4.1.4
|
40 |
*/
|
41 |
public function header_notices(){
|
42 |
+
if( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
43 |
?>
|
44 |
+
<div class="errormsgtopbx claimalert">
|
45 |
+
<div class="errmscntbx">
|
46 |
+
<div class="errmsglft">
|
47 |
+
<span class="errmsgicon"><img src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL.'/admin/images/error-white-icon.png'); ?>" alt="error" /></span>
|
48 |
+
</div>
|
49 |
+
<div class="erralertrigt">
|
50 |
+
<h6><?php echo esc_html_e("Hey,.","conversios"); ?></h6>
|
51 |
+
<p><?php echo esc_html_e("It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin required.","conversios"); ?> </p>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<?php
|
56 |
+
}else{
|
57 |
+
if($this->plan_id == 1){
|
58 |
+
?>
|
59 |
+
<!--- Promotion box start -->
|
60 |
+
<div class="promobandtop">
|
61 |
+
<div class="container-fluid">
|
62 |
+
<div class="row">
|
63 |
+
<div class="promoleft">
|
64 |
+
<div class="promobandmsg">
|
65 |
+
<?php esc_html_e("Level up your game by getting detail insights on every products. Make the informed decision for your next campaign.","conversios"); ?>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
<div class="promoright">
|
69 |
+
<div class="prmoupgrdbtn">
|
70 |
+
<a target="_blank" href="<?php echo esc_url_raw($this->get_pro_plan_site().'?utm_source=EE+Plugin+User+Interface&utm_medium=Top+Bar+upgrading+to+pro&utm_campaign=Upsell+at+Conversios'); ?>" class="upgradebtn"><?php esc_html_e("Upgrade","conversios"); ?></a>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<!--- Promotion box end -->
|
77 |
+
<?php
|
78 |
+
}
|
79 |
+
echo esc_attr($this->call_tvc_site_verified_and_domain_claim());
|
80 |
+
}
|
81 |
}
|
82 |
/**
|
83 |
* header section
|
85 |
* @since 4.1.4
|
86 |
*/
|
87 |
public function conversios_header(){
|
88 |
+
|
89 |
$plan_name = esc_html__("Free Plan","conversios");
|
90 |
if(isset($this->subscription_data->plan_name) && !in_array($this->subscription_data->plan_id, array("1"))){
|
91 |
$plan_name = $this->subscription_data->plan_name;
|
127 |
}
|
128 |
public function conversios_menu_list(){
|
129 |
//slug => arra();
|
130 |
+
$conversios_menu_list = array();
|
131 |
+
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
132 |
+
$conversios_menu_list = array(
|
133 |
+
'conversios' => array(
|
134 |
+
'title'=>'Dashboard',
|
135 |
+
'icon'=>esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/conversios-menu.png"),
|
136 |
+
'acitve_icon'=>esc_url_raw(ENHANCAD_PLUGIN_URL."/admin/images/active-conversios-menu.png")
|
137 |
+
),
|
138 |
+
'conversios-google-shopping-feed'=>array('title'=>esc_html__('Google Shopping','conversios')),
|
139 |
+
'conversios-google-ads'=>array('title'=>esc_html__('Google Ads','conversios')),
|
140 |
+
'conversios-google-analytics'=>array('title'=>esc_html__('Account Settings','conversios')),
|
141 |
+
);
|
142 |
+
}
|
143 |
if($this->plan_id == 1){
|
144 |
$conversios_menu_list['conversios-pricings'] = array('title'=>esc_html__('Free Vs Pro','conversios'),'icon'=>'');
|
145 |
}
|
admin/partials/general-fields.php
CHANGED
@@ -27,12 +27,14 @@ if (isset($_POST['ee_submit_plugin'])) {
|
|
27 |
//$_POST['ga_gCkout'] = 'on';
|
28 |
$settings['ga_Impr'] = isset($_POST["ga_Impr"])?sanitize_text_field($_POST["ga_Impr"]):"1";
|
29 |
$settings['ga_IPA'] = isset($_POST["ga_IPA"])?sanitize_text_field($_POST["ga_IPA"]):"";
|
30 |
-
|
31 |
$settings['ga_PrivacyPolicy'] = isset($_POST["ga_PrivacyPolicy"])?sanitize_text_field($_POST["ga_PrivacyPolicy"]):"";
|
32 |
$settings['google-analytic'] = '';
|
33 |
$settings['tvc_conversion_tracking_type'] = isset($_POST["tvc_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_conversion_tracking_type"]):"";
|
|
|
34 |
|
35 |
$TVC_Admin_Helper->save_ee_options_settings($settings);
|
|
|
36 |
|
37 |
$class = 'alert-message tvc-alert-success';
|
38 |
$message_p = esc_html__( 'Your settings have been saved.', 'conversios' );
|
@@ -221,6 +223,7 @@ if(isset($google_detail['setting'])){
|
|
221 |
<i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("If your thank you page conversion tracking does not work with the current tracking method then switch to another method.","conversios"); ?>"></i>
|
222 |
</td>
|
223 |
</tr>
|
|
|
224 |
<tr>
|
225 |
<th>
|
226 |
<label class = "align-middle" for="ga_OPTOUT"><?php esc_html_e("Google Analytics Opt Out","conversios"); ?></label>
|
@@ -234,6 +237,16 @@ if(isset($google_detail['setting'])){
|
|
234 |
<i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("Use this feature to provide website visitors the ability to prevent their data from being used by Google Analytics As per the GDPR compliance.Go through the documentation to check the setup","conversios"); ?>"></i>
|
235 |
</label>
|
236 |
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
</tr>
|
238 |
<tr>
|
239 |
<th>
|
@@ -263,6 +276,12 @@ if(isset($google_detail['setting'])){
|
|
263 |
</div>
|
264 |
<div class="col-md-6 col-lg-4">
|
265 |
<?php echo get_tvc_google_ga_sidebar(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
</div>
|
267 |
</div>
|
268 |
</div>
|
@@ -273,6 +292,21 @@ if(isset($google_detail['setting'])){
|
|
273 |
?>
|
274 |
<script>
|
275 |
jQuery(document).ready(function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
jQuery(document).on('click','#tvc_google_connect_active_licence_close',function(event){
|
277 |
jQuery('#tvc_google_connect_active_licence').modal('hide');
|
278 |
});
|
27 |
//$_POST['ga_gCkout'] = 'on';
|
28 |
$settings['ga_Impr'] = isset($_POST["ga_Impr"])?sanitize_text_field($_POST["ga_Impr"]):"1";
|
29 |
$settings['ga_IPA'] = isset($_POST["ga_IPA"])?sanitize_text_field($_POST["ga_IPA"]):"";
|
30 |
+
//$settings['ga_OPTOUT'] = isset($_POST["ga_OPTOUT"])?sanitize_text_field($_POST["ga_OPTOUT"]):"";
|
31 |
$settings['ga_PrivacyPolicy'] = isset($_POST["ga_PrivacyPolicy"])?sanitize_text_field($_POST["ga_PrivacyPolicy"]):"";
|
32 |
$settings['google-analytic'] = '';
|
33 |
$settings['tvc_conversion_tracking_type'] = isset($_POST["tvc_conversion_tracking_type"])?sanitize_text_field($_POST["tvc_conversion_tracking_type"]):"";
|
34 |
+
$settings['fb_pixel_id'] = isset($_POST["fb_pixel_id"])?sanitize_text_field($_POST["fb_pixel_id"]):"";
|
35 |
|
36 |
$TVC_Admin_Helper->save_ee_options_settings($settings);
|
37 |
+
$TVC_Admin_Helper->update_app_status();
|
38 |
|
39 |
$class = 'alert-message tvc-alert-success';
|
40 |
$message_p = esc_html__( 'Your settings have been saved.', 'conversios' );
|
223 |
<i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("If your thank you page conversion tracking does not work with the current tracking method then switch to another method.","conversios"); ?>"></i>
|
224 |
</td>
|
225 |
</tr>
|
226 |
+
<?php /*
|
227 |
<tr>
|
228 |
<th>
|
229 |
<label class = "align-middle" for="ga_OPTOUT"><?php esc_html_e("Google Analytics Opt Out","conversios"); ?></label>
|
237 |
<i style="cursor: help;" class="fas fa-question-circle" title="<?php esc_html_e("Use this feature to provide website visitors the ability to prevent their data from being used by Google Analytics As per the GDPR compliance.Go through the documentation to check the setup","conversios"); ?>"></i>
|
238 |
</label>
|
239 |
</td>
|
240 |
+
</tr> */ ?>
|
241 |
+
<tr>
|
242 |
+
<th>
|
243 |
+
<img style="height: 20px;" src="<?php echo esc_url_raw(ENHANCAD_PLUGIN_URL . "/admin/images/fb-icon.png"); ?>" > Facebook pixel ID
|
244 |
+
</th>
|
245 |
+
<td>
|
246 |
+
<?php $fb_pixel_id = isset($data['fb_pixel_id'])?$data['fb_pixel_id']:""; ?>
|
247 |
+
<input type="text" class="fromfiled" name="fb_pixel_id" id="fb_pixel_id" value="<?php echo esc_attr($fb_pixel_id); ?>">
|
248 |
+
<small>The Facebook pixel ID looks like. 518896233175751</small>
|
249 |
+
</td>
|
250 |
</tr>
|
251 |
<tr>
|
252 |
<th>
|
276 |
</div>
|
277 |
<div class="col-md-6 col-lg-4">
|
278 |
<?php echo get_tvc_google_ga_sidebar(); ?>
|
279 |
+
<div class="tvc-youtube-video">
|
280 |
+
<span>Video tutorial:</span>
|
281 |
+
<a href="https://www.youtube.com/watch?v=FAV4mybKogg" target="_blank">Walkthrough about Onboarding</a>
|
282 |
+
<a href="https://www.youtube.com/watch?v=4pb-oPWHb-8" target="_blank">Walkthrough about Product Sync</a>
|
283 |
+
<a href="https://www.youtube.com/watch?v=_C9cemX6jCM" target="_blank">Walkthrough about Smart Shopping Campaign</a>
|
284 |
+
</div>
|
285 |
</div>
|
286 |
</div>
|
287 |
</div>
|
292 |
?>
|
293 |
<script>
|
294 |
jQuery(document).ready(function () {
|
295 |
+
/*facebook*/
|
296 |
+
jQuery("#fb_pixel_id").keypress(function (evt){
|
297 |
+
var theEvent = evt || window.event;
|
298 |
+
var key = theEvent.keyCode || theEvent.which;
|
299 |
+
key = String.fromCharCode( key );
|
300 |
+
var regex = /[-\d\.]/; // dowolna liczba (+- ,.) :)
|
301 |
+
var objRegex = /^-?\d*[\.]?\d*$/;
|
302 |
+
var val = $(evt.target).val();
|
303 |
+
if(!regex.test(key) || !objRegex.test(val+key) ||
|
304 |
+
!theEvent.keyCode == 46 || !theEvent.keyCode == 8) {
|
305 |
+
theEvent.returnValue = false;
|
306 |
+
if(theEvent.preventDefault) theEvent.preventDefault();
|
307 |
+
};
|
308 |
+
});
|
309 |
+
|
310 |
jQuery(document).on('click','#tvc_google_connect_active_licence_close',function(event){
|
311 |
jQuery('#tvc_google_connect_active_licence').modal('hide');
|
312 |
});
|
enhanced-ecommerce-google-analytics.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce
|
16 |
* Plugin URI: https://www.tatvic.com/tatvic-labs/woocommerce-extension/
|
17 |
* Description: Automates eCommerce tracking in Google Analytics, dynamic remarkting in Google Ads, and provides complete Google Shopping features.
|
18 |
-
* Version: 4.
|
19 |
* Author: Tatvic
|
20 |
* Author URI: www.tatvic.com
|
21 |
* License: GPL-2.0+
|
@@ -23,7 +23,7 @@
|
|
23 |
* Text Domain: www.tatvic.com
|
24 |
* Domain Path: /languages
|
25 |
* WC requires at least: 3.5.0
|
26 |
-
* WC tested up to: 6.
|
27 |
*/
|
28 |
|
29 |
/**
|
@@ -37,7 +37,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
37 |
* Start at version 1.0.0 and use SemVer - https://semver.org
|
38 |
* Rename this for your plugin and update it as you release new versions.
|
39 |
*/
|
40 |
-
define( 'PLUGIN_TVC_VERSION', '4.
|
41 |
$fullName = plugin_basename( __FILE__ );
|
42 |
$dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
|
43 |
if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
|
15 |
* Plugin Name: Conversios.io - Google Analytics and Google Shopping plugin for WooCommerce
|
16 |
* Plugin URI: https://www.tatvic.com/tatvic-labs/woocommerce-extension/
|
17 |
* Description: Automates eCommerce tracking in Google Analytics, dynamic remarkting in Google Ads, and provides complete Google Shopping features.
|
18 |
+
* Version: 4.7.0
|
19 |
* Author: Tatvic
|
20 |
* Author URI: www.tatvic.com
|
21 |
* License: GPL-2.0+
|
23 |
* Text Domain: www.tatvic.com
|
24 |
* Domain Path: /languages
|
25 |
* WC requires at least: 3.5.0
|
26 |
+
* WC tested up to: 6.3.1
|
27 |
*/
|
28 |
|
29 |
/**
|
37 |
* Start at version 1.0.0 and use SemVer - https://semver.org
|
38 |
* Rename this for your plugin and update it as you release new versions.
|
39 |
*/
|
40 |
+
define( 'PLUGIN_TVC_VERSION', '4.7.0' );
|
41 |
$fullName = plugin_basename( __FILE__ );
|
42 |
$dir = str_replace('/enhanced-ecommerce-google-analytics.php','',$fullName);
|
43 |
if ( ! defined( 'ENHANCAD_PLUGIN_NAME' ) ) {
|
includes/class-enhanced-ecommerce-google-analytics-activator.php
CHANGED
@@ -34,5 +34,7 @@ class Enhanced_Ecommerce_Google_Analytics_Activator {
|
|
34 |
if (!is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
35 |
wp_die(wp_sprintf("%s <br><a href='" . esc_url_raw(admin_url( 'plugins.php' )) . "'>« %s</a>", esc_html__("Hey, It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin can only be activated if you have active WooCommerce plugin in your wp-admin.","conversios"), esc_html__("Return to Plugins","conversios")));
|
36 |
}
|
|
|
|
|
37 |
}
|
38 |
}
|
34 |
if (!is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
35 |
wp_die(wp_sprintf("%s <br><a href='" . esc_url_raw(admin_url( 'plugins.php' )) . "'>« %s</a>", esc_html__("Hey, It seems WooCommerce plugin is not active on your wp-admin. Conversios.io - Google Analytics and Google Shopping plugin can only be activated if you have active WooCommerce plugin in your wp-admin.","conversios"), esc_html__("Return to Plugins","conversios")));
|
36 |
}
|
37 |
+
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
38 |
+
$TVC_Admin_Helper->update_app_status();
|
39 |
}
|
40 |
}
|
includes/class-enhanced-ecommerce-google-analytics-deactivator.php
CHANGED
@@ -30,7 +30,10 @@ class Enhanced_Ecommerce_Google_Analytics_Deactivator {
|
|
30 |
* @since 1.0.0
|
31 |
*/
|
32 |
public static function deactivate() {
|
33 |
-
if (!current_user_can('activate_plugins'))
|
34 |
return;
|
|
|
|
|
|
|
35 |
}
|
36 |
}
|
30 |
* @since 1.0.0
|
31 |
*/
|
32 |
public static function deactivate() {
|
33 |
+
if (!current_user_can('activate_plugins')){
|
34 |
return;
|
35 |
+
}
|
36 |
+
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
37 |
+
$TVC_Admin_Helper->update_app_status("0");
|
38 |
}
|
39 |
}
|
includes/class-enhanced-ecommerce-google-analytics.php
CHANGED
@@ -139,13 +139,14 @@ class Enhanced_Ecommerce_Google_Analytics {
|
|
139 |
* The class responsible for defining all actions that occur in the public-facing
|
140 |
* side of the site.
|
141 |
*/
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
149 |
}
|
150 |
$this->loader = new Enhanced_Ecommerce_Google_Analytics_Loader();
|
151 |
}
|
@@ -190,7 +191,9 @@ class Enhanced_Ecommerce_Google_Analytics {
|
|
190 |
* @access private
|
191 |
*/
|
192 |
public function define_public_hooks() {
|
193 |
-
|
|
|
|
|
194 |
}
|
195 |
|
196 |
/**
|
139 |
* The class responsible for defining all actions that occur in the public-facing
|
140 |
* side of the site.
|
141 |
*/
|
142 |
+
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
143 |
+
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
144 |
+
$plan_id = $TVC_Admin_Helper->get_plan_id();
|
145 |
+
if($plan_id == 1){
|
146 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-enhanced-ecommerce-google-analytics-public.php';
|
147 |
+
}else{
|
148 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-enhanced-ecommerce-google-analytics-public-pro.php';
|
149 |
+
}
|
150 |
}
|
151 |
$this->loader = new Enhanced_Ecommerce_Google_Analytics_Loader();
|
152 |
}
|
191 |
* @access private
|
192 |
*/
|
193 |
public function define_public_hooks() {
|
194 |
+
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
195 |
+
new Enhanced_Ecommerce_Google_Analytics_Public( $this->get_plugin_name(), $this->get_version() );
|
196 |
+
}
|
197 |
}
|
198 |
|
199 |
/**
|
includes/setup/CustomApi.php
CHANGED
@@ -22,16 +22,16 @@ class CustomApi{
|
|
22 |
}
|
23 |
|
24 |
public function get_tvc_refresh_token(){
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
}
|
33 |
-
return $this->refresh_token;
|
34 |
}
|
|
|
|
|
35 |
}
|
36 |
|
37 |
public function tc_wp_remot_call_post($url, $args){
|
@@ -67,6 +67,44 @@ class CustomApi{
|
|
67 |
}
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
public function getGoogleAnalyticDetail($subscription_id = null) {
|
71 |
try {
|
72 |
|
22 |
}
|
23 |
|
24 |
public function get_tvc_refresh_token(){
|
25 |
+
if(!empty($this->refresh_token)){
|
26 |
+
return $this->refresh_token;
|
27 |
+
}else{
|
28 |
+
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
29 |
+
$google_detail = $TVC_Admin_Helper->get_ee_options_data();
|
30 |
+
if(isset($google_detail['setting']->refresh_token)){
|
31 |
+
$this->refresh_token = sanitize_text_field(base64_decode($google_detail['setting']->refresh_token));
|
|
|
|
|
32 |
}
|
33 |
+
return $this->refresh_token;
|
34 |
+
}
|
35 |
}
|
36 |
|
37 |
public function tc_wp_remot_call_post($url, $args){
|
67 |
}
|
68 |
}
|
69 |
|
70 |
+
public function update_app_status($status=1){
|
71 |
+
try {
|
72 |
+
$url = $this->apiDomain . '/customer-subscriptions/update-app-status';
|
73 |
+
$header = array(
|
74 |
+
"Authorization: Bearer ".$this->token,
|
75 |
+
"Content-Type" => "application/json"
|
76 |
+
);
|
77 |
+
|
78 |
+
$options = unserialize(get_option('ee_options'));
|
79 |
+
$fb_pixel_enable = "0";
|
80 |
+
if(isset($options['fb_pixel_id']) && $options['fb_pixel_id'] != ""){
|
81 |
+
$fb_pixel_enable = "1";
|
82 |
+
}
|
83 |
+
$TVC_Admin_Helper = new TVC_Admin_Helper();
|
84 |
+
$postData = array(
|
85 |
+
"subscription_id" => sanitize_text_field($TVC_Admin_Helper->get_subscriptionId()),
|
86 |
+
"domain" => esc_url_raw(get_site_url()),
|
87 |
+
"app_status_data" => array(
|
88 |
+
"app_settings" => array(
|
89 |
+
"app_status" => sanitize_text_field($status),
|
90 |
+
"fb_pixel_enable" => $fb_pixel_enable,
|
91 |
+
"app_verstion" => PLUGIN_TVC_VERSION,
|
92 |
+
"domain" => esc_url_raw(get_site_url()),
|
93 |
+
"update_date" => date("Y-m-d")
|
94 |
+
)
|
95 |
+
)
|
96 |
+
);
|
97 |
+
$args = array(
|
98 |
+
'headers' =>$header,
|
99 |
+
'method' => 'POST',
|
100 |
+
'body' => wp_json_encode($postData)
|
101 |
+
);
|
102 |
+
$this->tc_wp_remot_call_post(esc_url_raw($url), $args);
|
103 |
+
} catch (Exception $e) {
|
104 |
+
return $e->getMessage();
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
public function getGoogleAnalyticDetail($subscription_id = null) {
|
109 |
try {
|
110 |
|
includes/setup/google-ads.php
CHANGED
@@ -188,7 +188,13 @@ class GoogleAds {
|
|
188 |
</form>
|
189 |
</div>
|
190 |
<div class="col-md-6 col-lg-4">
|
191 |
-
<?php echo get_tvc_google_ads_help_html(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
</div>
|
193 |
</div>
|
194 |
</div>
|
188 |
</form>
|
189 |
</div>
|
190 |
<div class="col-md-6 col-lg-4">
|
191 |
+
<?php echo get_tvc_google_ads_help_html(); ?>
|
192 |
+
<div class="tvc-youtube-video">
|
193 |
+
<span>Video tutorial:</span>
|
194 |
+
<a href="https://www.youtube.com/watch?v=FAV4mybKogg" target="_blank">Walkthrough about Onboarding</a>
|
195 |
+
<a href="https://www.youtube.com/watch?v=4pb-oPWHb-8" target="_blank">Walkthrough about Product Sync</a>
|
196 |
+
<a href="https://www.youtube.com/watch?v=_C9cemX6jCM" target="_blank">Walkthrough about Smart Shopping Campaign</a>
|
197 |
+
</div>
|
198 |
</div>
|
199 |
</div>
|
200 |
</div>
|
public/class-enhanced-ecommerce-google-analytics-public-pro.php
CHANGED
@@ -49,7 +49,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
49 |
protected $ga_imTh;
|
50 |
|
51 |
protected $ga_IPA;
|
52 |
-
protected $ga_OPTOUT;
|
53 |
|
54 |
protected $ads_ert;
|
55 |
protected $ads_edrt;
|
@@ -67,6 +67,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
67 |
protected $tvc_conversion_tracking_type;
|
68 |
|
69 |
protected $ee_options;
|
|
|
70 |
|
71 |
/**
|
72 |
* Enhanced_Ecommerce_Google_Analytics_Public constructor.
|
@@ -97,7 +98,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
97 |
$this->ga_gUser = sanitize_text_field($this->get_option("ga_gUser") == "on" ? true : false); //guest checkout
|
98 |
$this->ga_DF = sanitize_text_field($this->get_option("ga_DF") == "on" ? true : false);
|
99 |
$this->ga_imTh = sanitize_text_field($this->get_option("ga_Impr") == "" ? 6 : $this->get_option("ga_Impr"));
|
100 |
-
|
101 |
$this->ga_PrivacyPolicy = sanitize_text_field($this->get_option("ga_PrivacyPolicy") == "on" ? true : false);
|
102 |
$this->ga_IPA = sanitize_text_field($this->get_option("ga_IPA") == "on" ? true : false); //IP Anony.
|
103 |
$this->ads_ert = get_option('ads_ert'); //Enable remarketing tags
|
@@ -111,7 +112,10 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
111 |
$this->remarketing_snippets = base64_decode($remarketing['snippets']);
|
112 |
$this->remarketing_snippet_id = sanitize_text_field(isset($remarketing['id'])?esc_attr($remarketing['id']):"");
|
113 |
}
|
114 |
-
|
|
|
|
|
|
|
115 |
$this->ga_LC = get_woocommerce_currency(); //Local Currency from Back end
|
116 |
$this->wc_version_compare("tvc_lc=" . json_encode(esc_js($this->ga_LC)) . ";");
|
117 |
/*
|
@@ -142,7 +146,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
142 |
"o_log_step_gest_user"=>esc_js($this->ga_gUser),
|
143 |
"o_impression_thresold"=>esc_js($this->ga_imTh),
|
144 |
"o_ip_anonymization"=>esc_js($this->ga_IPA),
|
145 |
-
"o_ga_OPTOUT"=>esc_js($this->ga_OPTOUT),
|
146 |
"ads_tracking_id"=>esc_js($this->ads_tracking_id),
|
147 |
"remarketing_tags"=>esc_js($this->ads_ert),
|
148 |
"dynamic_remarketing_tags"=>esc_js($this->ads_edrt),
|
@@ -153,6 +157,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
153 |
"user_type"=>esc_js($user_type),
|
154 |
"day_type"=>esc_js($this->add_day_type()),
|
155 |
"remarketing_snippet_id"=>esc_js($this->remarketing_snippet_id),
|
|
|
156 |
"tvc_ajax_url"=>esc_url_raw(admin_url( 'admin-ajax.php' ))
|
157 |
);
|
158 |
/*
|
@@ -183,7 +188,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
183 |
add_action("wp_head", array($this, "checkout_step_1_tracking"));
|
184 |
add_action("wp_head", array($this, "checkout_step_2_tracking"));
|
185 |
add_action("wp_head", array($this, "checkout_step_3_tracking"));
|
186 |
-
add_action("woocommerce_after_add_to_cart_button", array($this, "add_to_cart"));
|
|
|
187 |
//add version details in footer
|
188 |
add_action("wp_footer", array($this, "add_plugin_details"));
|
189 |
//Add Dev ID
|
@@ -301,6 +307,9 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
301 |
if(isset($this->ee_options[$key])){
|
302 |
return $this->ee_options[$key];
|
303 |
}
|
|
|
|
|
|
|
304 |
}
|
305 |
/**
|
306 |
* Get store meta data for trouble shoot
|
@@ -326,7 +335,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
326 |
't_UAen' => esc_js($this->ga_ST),
|
327 |
't_thr' => esc_js($this->ga_imTh),
|
328 |
't_IPA' => esc_js($this->ga_IPA),
|
329 |
-
't_OptOut' => esc_js($this->ga_OPTOUT),
|
330 |
't_PrivacyPolicy' => esc_js($this->ga_PrivacyPolicy)
|
331 |
),
|
332 |
'tvc_sub_data'=> array(
|
@@ -338,6 +347,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
338 |
'ga_measurement_id' => esc_js(isset($googleDetail->measurement_id)?sanitize_text_field($googleDetail->measurement_id):""),
|
339 |
'ga_ads_id' => esc_js(isset($googleDetail->google_ads_id)?sanitize_text_field($googleDetail->google_ads_id):""),
|
340 |
'ga_gmc_id' => esc_js(isset($googleDetail->google_merchant_center_id)?sanitize_text_field($googleDetail->google_merchant_center_id):""),
|
|
|
341 |
'op_gtag_js' => esc_js(isset($googleDetail->add_gtag_snippet)?sanitize_text_field($googleDetail->add_gtag_snippet):""),
|
342 |
'op_en_e_t' => esc_js(isset($googleDetail->enhanced_e_commerce_tracking)?sanitize_text_field($googleDetail->enhanced_e_commerce_tracking):""),
|
343 |
'op_rm_t_t' => esc_js(isset($googleDetail->remarketing_tags)?sanitize_text_field($googleDetail->remarketing_tags):""),
|
@@ -346,7 +356,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
346 |
'gmc_is_product_sync' => esc_js(isset($googleDetail->is_product_sync)?sanitize_text_field($googleDetail->is_product_sync):""),
|
347 |
'gmc_is_site_verified' => esc_js(isset($googleDetail->is_site_verified)?sanitize_text_field($googleDetail->is_site_verified):""),
|
348 |
'gmc_is_domain_claim' => esc_js(isset($googleDetail->is_domain_claim)?sanitize_text_field($googleDetail->is_domain_claim):""),
|
349 |
-
'gmc_product_count' => esc_js(isset($googleDetail->product_count)?sanitize_text_field($googleDetail->product_count):"")
|
|
|
350 |
)
|
351 |
);
|
352 |
$this->wc_version_compare("tvc_smd=" . json_encode($tvc_sMetaData) . ";");
|
@@ -434,7 +445,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
434 |
var ads_edrt = '<?php echo esc_js($this->ads_edrt)?>';
|
435 |
</script>
|
436 |
<?php
|
437 |
-
if($this->ga_OPTOUT) {
|
438 |
?>
|
439 |
<script>
|
440 |
// Set to the same value as the web property used on the site
|
@@ -452,7 +463,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
452 |
window[disableStr] = true;
|
453 |
}</script>
|
454 |
<?php
|
455 |
-
}
|
456 |
//add gtag js snippets
|
457 |
if( $this->tracking_option == "BOTH" && $this->gm_id && $this->ga_id){ ?>
|
458 |
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->gm_id); ?>"></script>
|
@@ -558,6 +569,29 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
558 |
}
|
559 |
}
|
560 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
}
|
562 |
protected function tvc_get_order_with_url_order_key(){
|
563 |
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
@@ -615,7 +649,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
615 |
$order = new WC_Order($order_id);
|
616 |
}
|
617 |
if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_tracked", true) == 1 || !is_order_received_page() ){
|
618 |
-
return;
|
619 |
}
|
620 |
get_post_meta($order_id, "_tracked", true);
|
621 |
// Doing eCommerce tracking so unhook standard tracking from the footer
|
@@ -743,12 +777,12 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
743 |
* @access public
|
744 |
* @return void
|
745 |
*/
|
746 |
-
function
|
747 |
if ($this->disable_tracking($this->ga_eeT)){
|
748 |
return;
|
749 |
}
|
750 |
//return if not product page
|
751 |
-
if (!is_single()){
|
752 |
return;
|
753 |
}
|
754 |
global $product,$woocommerce;
|
@@ -1069,6 +1103,10 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1069 |
|
1070 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1071 |
t_call_fired=true;
|
|
|
|
|
|
|
|
|
1072 |
// Enhanced E-commerce Add to cart clicks
|
1073 |
gtag("event", "add_to_cart", {
|
1074 |
"event_category":"Enhanced-Ecommerce",
|
@@ -1198,6 +1236,10 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1198 |
function prod_ATC_link_exists(t_url,t_ATC_json_name,t_prod_data_json,t_qty){
|
1199 |
t_prod_url_key=t_ATC_json_name[t_url]["ATC-link"];
|
1200 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
|
|
|
|
|
|
|
|
1201 |
t_call_fired=true;
|
1202 |
// Enhanced E-commerce Add to cart clicks
|
1203 |
gtag("event", "add_to_cart", {
|
@@ -1230,9 +1272,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1230 |
t_call_fired=false;
|
1231 |
}
|
1232 |
return t_call_fired;
|
1233 |
-
}
|
1234 |
-
|
1235 |
-
}
|
1236 |
if(is_home() || is_front_page()){
|
1237 |
$hmpg_impressions_jQ .='
|
1238 |
if(tvc_fp.length !== 0){
|
@@ -1276,8 +1317,18 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1276 |
//cat page prod call for click
|
1277 |
prod_exists_in_JSON(t_url,tvc_pgc,"srch");
|
1278 |
});
|
1279 |
-
|
1280 |
';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1281 |
}else if (is_product()) {
|
1282 |
//product page releted products
|
1283 |
$hmpg_impressions_jQ .='
|
@@ -1456,54 +1507,21 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1456 |
if ($this->disable_tracking($this->ga_eeT) || !is_checkout() || is_order_received_page() ) {
|
1457 |
return;
|
1458 |
}
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
}';
|
1475 |
-
|
1476 |
-
$code_step_1 = $code . 'gtag("event", "begin_checkout", {"event_category":"Enhanced-Ecommerce",
|
1477 |
-
"event_label":"checkout_step_1","items":items,"non_interaction": true });';
|
1478 |
-
|
1479 |
-
//check woocommerce version and add code
|
1480 |
-
$this->wc_version_compare($code_step_1);
|
1481 |
-
}
|
1482 |
-
|
1483 |
-
if( $this->gm_id && $this->tracking_option == "GA4") {
|
1484 |
-
$code = '
|
1485 |
-
var items = [];
|
1486 |
-
for(var t_item in tvc_ch){
|
1487 |
-
items.push({
|
1488 |
-
"item_id": tvc_ch[t_item].tvc_i,
|
1489 |
-
"item_name": tvc_ch[t_item].tvc_n,
|
1490 |
-
"item_category": tvc_ch[t_item].tvc_c,
|
1491 |
-
"item_variant": tvc_ch[t_item].tvc_attr,
|
1492 |
-
"price": tvc_ch[t_item].tvc_p,
|
1493 |
-
"quantity": tvc_ch[t_item].tvc_q
|
1494 |
-
});
|
1495 |
-
}';
|
1496 |
-
|
1497 |
-
$code_step_1 = $code . 'gtag("event", "begin_checkout", {
|
1498 |
-
"event_category":"Enhanced-Ecommerce",
|
1499 |
-
"event_label":"checkout_step_1",
|
1500 |
-
"items":items,
|
1501 |
-
"non_interaction": true
|
1502 |
-
});';
|
1503 |
-
|
1504 |
-
//check woocommerce version and add code
|
1505 |
-
$this->wc_version_compare($code_step_1);
|
1506 |
-
}
|
1507 |
}
|
1508 |
|
1509 |
/**
|
@@ -1625,5 +1643,6 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1625 |
//return $code;
|
1626 |
//make product data json on check out page
|
1627 |
$this->wc_version_compare("tvc_ch=" . json_encode($chkout_json) . ";");
|
|
|
1628 |
}
|
1629 |
}
|
49 |
protected $ga_imTh;
|
50 |
|
51 |
protected $ga_IPA;
|
52 |
+
//protected $ga_OPTOUT;
|
53 |
|
54 |
protected $ads_ert;
|
55 |
protected $ads_edrt;
|
67 |
protected $tvc_conversion_tracking_type;
|
68 |
|
69 |
protected $ee_options;
|
70 |
+
protected $fb_pixel_id;
|
71 |
|
72 |
/**
|
73 |
* Enhanced_Ecommerce_Google_Analytics_Public constructor.
|
98 |
$this->ga_gUser = sanitize_text_field($this->get_option("ga_gUser") == "on" ? true : false); //guest checkout
|
99 |
$this->ga_DF = sanitize_text_field($this->get_option("ga_DF") == "on" ? true : false);
|
100 |
$this->ga_imTh = sanitize_text_field($this->get_option("ga_Impr") == "" ? 6 : $this->get_option("ga_Impr"));
|
101 |
+
//$this->ga_OPTOUT = sanitize_text_field($this->get_option("ga_OPTOUT") == "on" ? true : false); //Google Analytics Opt Out
|
102 |
$this->ga_PrivacyPolicy = sanitize_text_field($this->get_option("ga_PrivacyPolicy") == "on" ? true : false);
|
103 |
$this->ga_IPA = sanitize_text_field($this->get_option("ga_IPA") == "on" ? true : false); //IP Anony.
|
104 |
$this->ads_ert = get_option('ads_ert'); //Enable remarketing tags
|
112 |
$this->remarketing_snippets = base64_decode($remarketing['snippets']);
|
113 |
$this->remarketing_snippet_id = sanitize_text_field(isset($remarketing['id'])?esc_attr($remarketing['id']):"");
|
114 |
}
|
115 |
+
|
116 |
+
/*facebook pixel*/
|
117 |
+
$this->fb_pixel_id = sanitize_text_field($this->get_option('fb_pixel_id'));
|
118 |
+
|
119 |
$this->ga_LC = get_woocommerce_currency(); //Local Currency from Back end
|
120 |
$this->wc_version_compare("tvc_lc=" . json_encode(esc_js($this->ga_LC)) . ";");
|
121 |
/*
|
146 |
"o_log_step_gest_user"=>esc_js($this->ga_gUser),
|
147 |
"o_impression_thresold"=>esc_js($this->ga_imTh),
|
148 |
"o_ip_anonymization"=>esc_js($this->ga_IPA),
|
149 |
+
//"o_ga_OPTOUT"=>esc_js($this->ga_OPTOUT),
|
150 |
"ads_tracking_id"=>esc_js($this->ads_tracking_id),
|
151 |
"remarketing_tags"=>esc_js($this->ads_ert),
|
152 |
"dynamic_remarketing_tags"=>esc_js($this->ads_edrt),
|
157 |
"user_type"=>esc_js($user_type),
|
158 |
"day_type"=>esc_js($this->add_day_type()),
|
159 |
"remarketing_snippet_id"=>esc_js($this->remarketing_snippet_id),
|
160 |
+
"fb_pixel_id"=>esc_js($this->fb_pixel_id),
|
161 |
"tvc_ajax_url"=>esc_url_raw(admin_url( 'admin-ajax.php' ))
|
162 |
);
|
163 |
/*
|
188 |
add_action("wp_head", array($this, "checkout_step_1_tracking"));
|
189 |
add_action("wp_head", array($this, "checkout_step_2_tracking"));
|
190 |
add_action("wp_head", array($this, "checkout_step_3_tracking"));
|
191 |
+
//add_action("woocommerce_after_add_to_cart_button", array($this, "add_to_cart"));
|
192 |
+
add_action("wp_footer", array($this, "single_add_to_cart"));
|
193 |
//add version details in footer
|
194 |
add_action("wp_footer", array($this, "add_plugin_details"));
|
195 |
//Add Dev ID
|
307 |
if(isset($this->ee_options[$key])){
|
308 |
return $this->ee_options[$key];
|
309 |
}
|
310 |
+
}
|
311 |
+
public function get_tvc_product_data($product_id){
|
312 |
+
|
313 |
}
|
314 |
/**
|
315 |
* Get store meta data for trouble shoot
|
335 |
't_UAen' => esc_js($this->ga_ST),
|
336 |
't_thr' => esc_js($this->ga_imTh),
|
337 |
't_IPA' => esc_js($this->ga_IPA),
|
338 |
+
//'t_OptOut' => esc_js($this->ga_OPTOUT),
|
339 |
't_PrivacyPolicy' => esc_js($this->ga_PrivacyPolicy)
|
340 |
),
|
341 |
'tvc_sub_data'=> array(
|
347 |
'ga_measurement_id' => esc_js(isset($googleDetail->measurement_id)?sanitize_text_field($googleDetail->measurement_id):""),
|
348 |
'ga_ads_id' => esc_js(isset($googleDetail->google_ads_id)?sanitize_text_field($googleDetail->google_ads_id):""),
|
349 |
'ga_gmc_id' => esc_js(isset($googleDetail->google_merchant_center_id)?sanitize_text_field($googleDetail->google_merchant_center_id):""),
|
350 |
+
'ga_gmc_id_p' => esc_js(isset($googleDetail->merchant_id)?sanitize_text_field($googleDetail->merchant_id):""),
|
351 |
'op_gtag_js' => esc_js(isset($googleDetail->add_gtag_snippet)?sanitize_text_field($googleDetail->add_gtag_snippet):""),
|
352 |
'op_en_e_t' => esc_js(isset($googleDetail->enhanced_e_commerce_tracking)?sanitize_text_field($googleDetail->enhanced_e_commerce_tracking):""),
|
353 |
'op_rm_t_t' => esc_js(isset($googleDetail->remarketing_tags)?sanitize_text_field($googleDetail->remarketing_tags):""),
|
356 |
'gmc_is_product_sync' => esc_js(isset($googleDetail->is_product_sync)?sanitize_text_field($googleDetail->is_product_sync):""),
|
357 |
'gmc_is_site_verified' => esc_js(isset($googleDetail->is_site_verified)?sanitize_text_field($googleDetail->is_site_verified):""),
|
358 |
'gmc_is_domain_claim' => esc_js(isset($googleDetail->is_domain_claim)?sanitize_text_field($googleDetail->is_domain_claim):""),
|
359 |
+
'gmc_product_count' => esc_js(isset($googleDetail->product_count)?sanitize_text_field($googleDetail->product_count):""),
|
360 |
+
'fb_pixel_id' => esc_js($this->fb_pixel_id)
|
361 |
)
|
362 |
);
|
363 |
$this->wc_version_compare("tvc_smd=" . json_encode($tvc_sMetaData) . ";");
|
445 |
var ads_edrt = '<?php echo esc_js($this->ads_edrt)?>';
|
446 |
</script>
|
447 |
<?php
|
448 |
+
/*if($this->ga_OPTOUT) {
|
449 |
?>
|
450 |
<script>
|
451 |
// Set to the same value as the web property used on the site
|
463 |
window[disableStr] = true;
|
464 |
}</script>
|
465 |
<?php
|
466 |
+
}*/
|
467 |
//add gtag js snippets
|
468 |
if( $this->tracking_option == "BOTH" && $this->gm_id && $this->ga_id){ ?>
|
469 |
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($this->gm_id); ?>"></script>
|
569 |
}
|
570 |
}
|
571 |
}
|
572 |
+
|
573 |
+
/*facebook pixel*/
|
574 |
+
if($this->fb_pixel_id != ""){
|
575 |
+
?>
|
576 |
+
<!-- Meta Pixel Code -->
|
577 |
+
<script>
|
578 |
+
!function(f,b,e,v,n,t,s)
|
579 |
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
580 |
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
581 |
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
582 |
+
n.queue=[];t=b.createElement(e);t.async=!0;
|
583 |
+
t.src=v;s=b.getElementsByTagName(e)[0];
|
584 |
+
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
585 |
+
'https://connect.facebook.net/en_US/fbevents.js');
|
586 |
+
fbq('init', '<?php echo esc_js($this->fb_pixel_id); ?>');
|
587 |
+
fbq('track', 'PageView');
|
588 |
+
</script>
|
589 |
+
<noscript><img height="1" width="1" style="display:none"
|
590 |
+
src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev=PageView&noscript=1"
|
591 |
+
/></noscript>
|
592 |
+
<!-- End Meta Pixel Code -->
|
593 |
+
<?php
|
594 |
+
}
|
595 |
}
|
596 |
protected function tvc_get_order_with_url_order_key(){
|
597 |
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
649 |
$order = new WC_Order($order_id);
|
650 |
}
|
651 |
if ($this->disable_tracking($this->ga_eeT) || current_user_can("manage_options") || get_post_meta($order_id, "_tracked", true) == 1 || !is_order_received_page() ){
|
652 |
+
//return;
|
653 |
}
|
654 |
get_post_meta($order_id, "_tracked", true);
|
655 |
// Doing eCommerce tracking so unhook standard tracking from the footer
|
777 |
* @access public
|
778 |
* @return void
|
779 |
*/
|
780 |
+
function single_add_to_cart() {
|
781 |
if ($this->disable_tracking($this->ga_eeT)){
|
782 |
return;
|
783 |
}
|
784 |
//return if not product page
|
785 |
+
if (!is_single() || !is_product() ){
|
786 |
return;
|
787 |
}
|
788 |
global $product,$woocommerce;
|
1103 |
|
1104 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1105 |
t_call_fired=true;
|
1106 |
+
/*facebook pixel */
|
1107 |
+
tvc_js = new TVC_Enhanced('.json_encode($this->tvc_options).');
|
1108 |
+
tvc_js.add_to_cart_click_fb(t_prod_data_json[t_prod_url_key], t_qty);
|
1109 |
+
|
1110 |
// Enhanced E-commerce Add to cart clicks
|
1111 |
gtag("event", "add_to_cart", {
|
1112 |
"event_category":"Enhanced-Ecommerce",
|
1236 |
function prod_ATC_link_exists(t_url,t_ATC_json_name,t_prod_data_json,t_qty){
|
1237 |
t_prod_url_key=t_ATC_json_name[t_url]["ATC-link"];
|
1238 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1239 |
+
/*facebook pixel */
|
1240 |
+
tvc_js = new TVC_Enhanced('.json_encode($this->tvc_options).');
|
1241 |
+
tvc_js.add_to_cart_click_fb(t_prod_data_json[t_prod_url_key], t_qty);
|
1242 |
+
|
1243 |
t_call_fired=true;
|
1244 |
// Enhanced E-commerce Add to cart clicks
|
1245 |
gtag("event", "add_to_cart", {
|
1272 |
t_call_fired=false;
|
1273 |
}
|
1274 |
return t_call_fired;
|
1275 |
+
}';
|
1276 |
+
}
|
|
|
1277 |
if(is_home() || is_front_page()){
|
1278 |
$hmpg_impressions_jQ .='
|
1279 |
if(tvc_fp.length !== 0){
|
1317 |
//cat page prod call for click
|
1318 |
prod_exists_in_JSON(t_url,tvc_pgc,"srch");
|
1319 |
});
|
|
|
1320 |
';
|
1321 |
+
$keyword = get_search_query();
|
1322 |
+
?>
|
1323 |
+
<script>
|
1324 |
+
window.addEventListener('load', call_search_page,true);
|
1325 |
+
function call_search_page(){
|
1326 |
+
tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
|
1327 |
+
tvc_js.search_page(<?php echo json_encode($catpage_json); ?>, <?php echo json_encode($keyword); ?>);
|
1328 |
+
}
|
1329 |
+
</script>
|
1330 |
+
<?php
|
1331 |
+
|
1332 |
}else if (is_product()) {
|
1333 |
//product page releted products
|
1334 |
$hmpg_impressions_jQ .='
|
1507 |
if ($this->disable_tracking($this->ga_eeT) || !is_checkout() || is_order_received_page() ) {
|
1508 |
return;
|
1509 |
}
|
1510 |
+
if($this->ga_id || $this->tracking_option == "UA" || $this->tracking_option == "BOTH") {
|
1511 |
+
//call fn to make json
|
1512 |
+
$chkout_json = $this->get_ordered_items();
|
1513 |
+
$cart_total = WC()->cart->total;
|
1514 |
+
//$amount2 = floatval($cart_total );
|
1515 |
+
?>
|
1516 |
+
<script>
|
1517 |
+
window.addEventListener('load', call_checkout_step_1_tracking,true);
|
1518 |
+
function call_checkout_step_1_tracking(){
|
1519 |
+
tvc_js = new TVC_Enhanced(<?php echo json_encode($this->tvc_options); ?>);
|
1520 |
+
tvc_js.checkout_step_1_tracking(<?php echo json_encode($chkout_json); ?>, <?php echo json_encode($cart_total); ?>);
|
1521 |
+
}
|
1522 |
+
</script>
|
1523 |
+
<?php
|
1524 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1525 |
}
|
1526 |
|
1527 |
/**
|
1643 |
//return $code;
|
1644 |
//make product data json on check out page
|
1645 |
$this->wc_version_compare("tvc_ch=" . json_encode($chkout_json) . ";");
|
1646 |
+
return $chkout_json;
|
1647 |
}
|
1648 |
}
|
public/class-enhanced-ecommerce-google-analytics-public.php
CHANGED
@@ -61,7 +61,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
61 |
/**
|
62 |
* @var bool $ga_OPTOUT
|
63 |
*/
|
64 |
-
protected $ga_OPTOUT;
|
65 |
/**
|
66 |
* @var bool $ga_PrivacyPolicy
|
67 |
*/
|
@@ -99,6 +99,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
99 |
protected $tvc_conversion_tracking_type;
|
100 |
|
101 |
protected $ee_options;
|
|
|
|
|
102 |
/**
|
103 |
* Enhanced_Ecommerce_Google_Analytics_Public constructor.
|
104 |
* @param $plugin_name
|
@@ -129,7 +131,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
129 |
$this->ga_gUser = sanitize_text_field($this->get_option("ga_gUser") == "on" ? true : false); //guest checkout
|
130 |
$this->ga_DF = sanitize_text_field($this->get_option("ga_DF") == "on" ? true : false);
|
131 |
$this->ga_imTh = sanitize_text_field($this->get_option("ga_Impr") == "" ? 6 : $this->get_option("ga_Impr"));
|
132 |
-
|
133 |
$this->ga_PrivacyPolicy = sanitize_text_field($this->get_option("ga_PrivacyPolicy") == "on" ? true : false);
|
134 |
$this->ga_IPA = sanitize_text_field($this->get_option("ga_IPA") == "on" ? true : false); //IP Anony.
|
135 |
$this->ads_ert = sanitize_text_field(get_option('ads_ert')); //Enable remarketing tags
|
@@ -143,6 +145,9 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
143 |
}
|
144 |
$this->ga_LC = get_woocommerce_currency(); //Local Currency from Back end
|
145 |
$this->wc_version_compare("tvc_lc=" . json_encode(esc_js($this->ga_LC)) . ";");
|
|
|
|
|
|
|
146 |
|
147 |
}
|
148 |
public function tvc_call_hooks(){
|
@@ -167,7 +172,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
167 |
add_action("wp_head", array($this, "checkout_step_1_tracking"));
|
168 |
add_action("wp_head", array($this, "checkout_step_2_tracking"));
|
169 |
add_action("wp_head", array($this, "checkout_step_3_tracking"));
|
170 |
-
add_action("woocommerce_after_add_to_cart_button", array($this, "add_to_cart"));
|
|
|
171 |
//add version details in footer
|
172 |
add_action("wp_footer", array($this, "add_plugin_details"));
|
173 |
//Add Dev ID
|
@@ -214,7 +220,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
214 |
't_UAen' => esc_js($this->ga_ST),
|
215 |
't_thr' => esc_js($this->ga_imTh),
|
216 |
't_IPA' => esc_js($this->ga_IPA),
|
217 |
-
't_OptOut' => esc_js($this->ga_OPTOUT),
|
218 |
't_PrivacyPolicy' => esc_js($this->ga_PrivacyPolicy)
|
219 |
),
|
220 |
'tvc_sub_data'=> array(
|
@@ -234,7 +240,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
234 |
'gmc_is_product_sync' => esc_js(isset($googleDetail->is_product_sync)?sanitize_text_field($googleDetail->is_product_sync):""),
|
235 |
'gmc_is_site_verified' => esc_js(isset($googleDetail->is_site_verified)?sanitize_text_field($googleDetail->is_site_verified):""),
|
236 |
'gmc_is_domain_claim' => esc_js(isset($googleDetail->is_domain_claim)?sanitize_text_field($googleDetail->is_domain_claim):""),
|
237 |
-
'gmc_product_count' => esc_js(isset($googleDetail->product_count)?sanitize_text_field($googleDetail->product_count):"")
|
|
|
238 |
)
|
239 |
);
|
240 |
$this->wc_version_compare("tvc_smd=" . json_encode($tvc_sMetaData) . ";");
|
@@ -338,7 +345,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
338 |
var remarketing_snippet_id = '<?php echo esc_js($this->remarketing_snippet_id); ?>';
|
339 |
</script>
|
340 |
<?php
|
341 |
-
if($this->ga_OPTOUT) {
|
342 |
?>
|
343 |
<script>
|
344 |
// Set to the same value as the web property used on the site
|
@@ -357,7 +364,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
357 |
}
|
358 |
</script>
|
359 |
<?php
|
360 |
-
}
|
361 |
|
362 |
if(($tracking_opt == "UA" || $tracking_id || $tracking_opt == "") && $tracking_opt != "BOTH"){?>
|
363 |
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($tracking_id); ?>"></script>
|
@@ -402,6 +409,29 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
402 |
}
|
403 |
}
|
404 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
}
|
406 |
protected function tvc_get_order_with_url_order_key(){
|
407 |
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
@@ -663,6 +693,34 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
663 |
$this->wc_version_compare($code);
|
664 |
update_post_meta($order_id, "_tracked", 1);
|
665 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
}
|
667 |
|
668 |
/**
|
@@ -671,15 +729,15 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
671 |
* @access public
|
672 |
* @return void
|
673 |
*/
|
674 |
-
function
|
675 |
-
if ($this->disable_tracking($this->ga_eeT))
|
676 |
-
|
|
|
677 |
//return if not product page
|
678 |
-
if (!is_single())
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
$category = get_the_terms($product->get_id(), "product_cat");
|
684 |
$categories = "";
|
685 |
if ($category) {
|
@@ -730,7 +788,7 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
730 |
if($this->gm_id && $this->tracking_option == "GA4") {
|
731 |
$code = '
|
732 |
var items = [];
|
733 |
-
jQuery("[class
|
734 |
gtag("event", "add_to_cart", {
|
735 |
"event_category":"Enhanced-Ecommerce",
|
736 |
"event_label":"add_to_cart_click",
|
@@ -762,6 +820,25 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
762 |
';
|
763 |
$this->wc_version_compare($code);
|
764 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
}
|
766 |
|
767 |
/**
|
@@ -1125,6 +1202,20 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1125 |
|
1126 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1127 |
t_call_fired=true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1128 |
// Enhanced E-commerce Add to cart clicks
|
1129 |
gtag("event", "add_to_cart", {
|
1130 |
"event_category":"Enhanced-Ecommerce",
|
@@ -1255,6 +1346,20 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1255 |
t_prod_url_key=t_ATC_json_name[t_url]["ATC-link"];
|
1256 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1257 |
t_call_fired=true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1258 |
// Enhanced E-commerce Add to cart clicks
|
1259 |
gtag("event", "add_to_cart", {
|
1260 |
"event_category":"Enhanced-Ecommerce",
|
@@ -1510,7 +1615,8 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1510 |
return;
|
1511 |
}
|
1512 |
//call fn to make json
|
1513 |
-
$this->get_ordered_items();
|
|
|
1514 |
if($this->ga_id || $this->tracking_option == "UA" || $this->tracking_option == "BOTH") {
|
1515 |
$code= '
|
1516 |
var items = [];
|
@@ -1557,6 +1663,32 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1557 |
//check woocommerce version and add code
|
1558 |
$this->wc_version_compare($code_step_1);
|
1559 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1560 |
}
|
1561 |
|
1562 |
/**
|
@@ -1677,5 +1809,6 @@ class Enhanced_Ecommerce_Google_Analytics_Public {
|
|
1677 |
//return $code;
|
1678 |
//make product data json on check out page
|
1679 |
$this->wc_version_compare("tvc_ch=" . json_encode($chkout_json) . ";");
|
|
|
1680 |
}
|
1681 |
}
|
61 |
/**
|
62 |
* @var bool $ga_OPTOUT
|
63 |
*/
|
64 |
+
//protected $ga_OPTOUT;
|
65 |
/**
|
66 |
* @var bool $ga_PrivacyPolicy
|
67 |
*/
|
99 |
protected $tvc_conversion_tracking_type;
|
100 |
|
101 |
protected $ee_options;
|
102 |
+
|
103 |
+
protected $fb_pixel_id;
|
104 |
/**
|
105 |
* Enhanced_Ecommerce_Google_Analytics_Public constructor.
|
106 |
* @param $plugin_name
|
131 |
$this->ga_gUser = sanitize_text_field($this->get_option("ga_gUser") == "on" ? true : false); //guest checkout
|
132 |
$this->ga_DF = sanitize_text_field($this->get_option("ga_DF") == "on" ? true : false);
|
133 |
$this->ga_imTh = sanitize_text_field($this->get_option("ga_Impr") == "" ? 6 : $this->get_option("ga_Impr"));
|
134 |
+
//$this->ga_OPTOUT = sanitize_text_field($this->get_option("ga_OPTOUT") == "on" ? true : false); //Google Analytics Opt Out
|
135 |
$this->ga_PrivacyPolicy = sanitize_text_field($this->get_option("ga_PrivacyPolicy") == "on" ? true : false);
|
136 |
$this->ga_IPA = sanitize_text_field($this->get_option("ga_IPA") == "on" ? true : false); //IP Anony.
|
137 |
$this->ads_ert = sanitize_text_field(get_option('ads_ert')); //Enable remarketing tags
|
145 |
}
|
146 |
$this->ga_LC = get_woocommerce_currency(); //Local Currency from Back end
|
147 |
$this->wc_version_compare("tvc_lc=" . json_encode(esc_js($this->ga_LC)) . ";");
|
148 |
+
|
149 |
+
/*facebook pixel*/
|
150 |
+
$this->fb_pixel_id = sanitize_text_field($this->get_option('fb_pixel_id'));
|
151 |
|
152 |
}
|
153 |
public function tvc_call_hooks(){
|
172 |
add_action("wp_head", array($this, "checkout_step_1_tracking"));
|
173 |
add_action("wp_head", array($this, "checkout_step_2_tracking"));
|
174 |
add_action("wp_head", array($this, "checkout_step_3_tracking"));
|
175 |
+
//add_action("woocommerce_after_add_to_cart_button", array($this, "add_to_cart"));
|
176 |
+
add_action("wp_footer", array($this, "single_add_to_cart"));
|
177 |
//add version details in footer
|
178 |
add_action("wp_footer", array($this, "add_plugin_details"));
|
179 |
//Add Dev ID
|
220 |
't_UAen' => esc_js($this->ga_ST),
|
221 |
't_thr' => esc_js($this->ga_imTh),
|
222 |
't_IPA' => esc_js($this->ga_IPA),
|
223 |
+
//'t_OptOut' => esc_js($this->ga_OPTOUT),
|
224 |
't_PrivacyPolicy' => esc_js($this->ga_PrivacyPolicy)
|
225 |
),
|
226 |
'tvc_sub_data'=> array(
|
240 |
'gmc_is_product_sync' => esc_js(isset($googleDetail->is_product_sync)?sanitize_text_field($googleDetail->is_product_sync):""),
|
241 |
'gmc_is_site_verified' => esc_js(isset($googleDetail->is_site_verified)?sanitize_text_field($googleDetail->is_site_verified):""),
|
242 |
'gmc_is_domain_claim' => esc_js(isset($googleDetail->is_domain_claim)?sanitize_text_field($googleDetail->is_domain_claim):""),
|
243 |
+
'gmc_product_count' => esc_js(isset($googleDetail->product_count)?sanitize_text_field($googleDetail->product_count):""),
|
244 |
+
'fb_pixel_id' => esc_js($this->fb_pixel_id)
|
245 |
)
|
246 |
);
|
247 |
$this->wc_version_compare("tvc_smd=" . json_encode($tvc_sMetaData) . ";");
|
345 |
var remarketing_snippet_id = '<?php echo esc_js($this->remarketing_snippet_id); ?>';
|
346 |
</script>
|
347 |
<?php
|
348 |
+
/*if($this->ga_OPTOUT) {
|
349 |
?>
|
350 |
<script>
|
351 |
// Set to the same value as the web property used on the site
|
364 |
}
|
365 |
</script>
|
366 |
<?php
|
367 |
+
}*/
|
368 |
|
369 |
if(($tracking_opt == "UA" || $tracking_id || $tracking_opt == "") && $tracking_opt != "BOTH"){?>
|
370 |
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo esc_js($tracking_id); ?>"></script>
|
409 |
}
|
410 |
}
|
411 |
}
|
412 |
+
|
413 |
+
/*facebook pixel*/
|
414 |
+
if($this->fb_pixel_id != ""){
|
415 |
+
?>
|
416 |
+
<!-- Meta Pixel Code -->
|
417 |
+
<script>
|
418 |
+
!function(f,b,e,v,n,t,s)
|
419 |
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
420 |
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
421 |
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
422 |
+
n.queue=[];t=b.createElement(e);t.async=!0;
|
423 |
+
t.src=v;s=b.getElementsByTagName(e)[0];
|
424 |
+
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
425 |
+
'https://connect.facebook.net/en_US/fbevents.js');
|
426 |
+
fbq('init', '<?php echo esc_js($this->fb_pixel_id); ?>');
|
427 |
+
fbq('track', 'PageView');
|
428 |
+
</script>
|
429 |
+
<noscript><img height="1" width="1" style="display:none"
|
430 |
+
src="https://www.facebook.com/tr?id=<?php echo esc_js($this->fb_pixel_id); ?>&ev=PageView&noscript=1"
|
431 |
+
/></noscript>
|
432 |
+
<!-- End Meta Pixel Code -->
|
433 |
+
<?php
|
434 |
+
}
|
435 |
}
|
436 |
protected function tvc_get_order_with_url_order_key(){
|
437 |
$_get = filter_input_array( INPUT_GET, FILTER_SANITIZE_STRING );
|
693 |
$this->wc_version_compare($code);
|
694 |
update_post_meta($order_id, "_tracked", 1);
|
695 |
}
|
696 |
+
|
697 |
+
/* facebook pixel */
|
698 |
+
if($this->fb_pixel_id != ""){
|
699 |
+
?>
|
700 |
+
<script>
|
701 |
+
var products = <?php echo json_encode($orderpage_prod_Array); ?>;
|
702 |
+
var cart_total = <?php echo json_encode($order->get_total()); ?>;
|
703 |
+
|
704 |
+
var fb_content_ids = [];
|
705 |
+
var fb_contents = [], num_items = 0;
|
706 |
+
for(var t_item in products){
|
707 |
+
num_items+=parseInt(products[t_item].tvc_q);
|
708 |
+
fb_content_ids.push(products[t_item].tvc_id);
|
709 |
+
fb_contents.push({"id":products[t_item].tvc_id, "quantity":products[t_item].tvc_q});
|
710 |
+
}
|
711 |
+
|
712 |
+
fbq("track", "Purchase", {
|
713 |
+
content_type : "product_group",
|
714 |
+
content_name : "Thankyou Page",
|
715 |
+
content_ids : fb_content_ids,
|
716 |
+
currency : "<?php echo esc_js($this->ga_LC); ?>",
|
717 |
+
num_items : num_items,
|
718 |
+
value : cart_total,
|
719 |
+
contents : fb_contents
|
720 |
+
})
|
721 |
+
</script>
|
722 |
+
<?php
|
723 |
+
}
|
724 |
}
|
725 |
|
726 |
/**
|
729 |
* @access public
|
730 |
* @return void
|
731 |
*/
|
732 |
+
function single_add_to_cart() {
|
733 |
+
if ($this->disable_tracking($this->ga_eeT)){
|
734 |
+
return;
|
735 |
+
}
|
736 |
//return if not product page
|
737 |
+
if (!is_single() || !is_product() ){
|
738 |
+
return;
|
739 |
+
}
|
740 |
+
global $product,$woocommerce;
|
|
|
741 |
$category = get_the_terms($product->get_id(), "product_cat");
|
742 |
$categories = "";
|
743 |
if ($category) {
|
788 |
if($this->gm_id && $this->tracking_option == "GA4") {
|
789 |
$code = '
|
790 |
var items = [];
|
791 |
+
jQuery("button[class*=\'btn-buy-shop\'],button[class*=\'single_add_to_cart_button\'], button[class*=\'add_to_cart\']").click(function() {
|
792 |
gtag("event", "add_to_cart", {
|
793 |
"event_category":"Enhanced-Ecommerce",
|
794 |
"event_label":"add_to_cart_click",
|
820 |
';
|
821 |
$this->wc_version_compare($code);
|
822 |
}
|
823 |
+
/* facebook pixel */
|
824 |
+
if($this->fb_pixel_id != ""){
|
825 |
+
?>
|
826 |
+
<script>
|
827 |
+
jQuery("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']").click(function() {
|
828 |
+
var quantity = jQuery(this).parent().find("input[name=quantity]").val();
|
829 |
+
fbq("track", "AddToCart", {
|
830 |
+
content_type : "product",
|
831 |
+
content_name : tvc_po.tvc_n,
|
832 |
+
content_ids : [tvc_po.tvc_id],
|
833 |
+
currency : tvc_lc,
|
834 |
+
value : tvc_po.tvc_p,
|
835 |
+
contents :[{id:tvc_po.tvc_id, 'quantity':quantity}]
|
836 |
+
})
|
837 |
+
});
|
838 |
+
</script>
|
839 |
+
<?php
|
840 |
+
}
|
841 |
+
|
842 |
}
|
843 |
|
844 |
/**
|
1202 |
|
1203 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1204 |
t_call_fired=true;
|
1205 |
+
/*facebook pixel */
|
1206 |
+
var fb_pixel_id = "'.esc_js($this->fb_pixel_id).'";
|
1207 |
+
var product = t_prod_data_json[t_prod_url_key];
|
1208 |
+
if(fb_pixel_id != ""){
|
1209 |
+
fbq("track", "AddToCart", {
|
1210 |
+
content_type : "product",
|
1211 |
+
content_name : product.tvc_n,
|
1212 |
+
content_ids : [product.tvc_id],
|
1213 |
+
currency : tvc_lc,
|
1214 |
+
value : product.tvc_p,
|
1215 |
+
contents :[{id:product.tvc_id, quantity:t_qty}]
|
1216 |
+
})
|
1217 |
+
}
|
1218 |
+
/*end facebook pixel */
|
1219 |
// Enhanced E-commerce Add to cart clicks
|
1220 |
gtag("event", "add_to_cart", {
|
1221 |
"event_category":"Enhanced-Ecommerce",
|
1346 |
t_prod_url_key=t_ATC_json_name[t_url]["ATC-link"];
|
1347 |
if(t_prod_data_json.hasOwnProperty(t_prod_url_key)){
|
1348 |
t_call_fired=true;
|
1349 |
+
/*facebook pixel */
|
1350 |
+
var fb_pixel_id = "'.esc_js($this->fb_pixel_id).'";
|
1351 |
+
var product = t_prod_data_json[t_prod_url_key];
|
1352 |
+
if(fb_pixel_id != ""){
|
1353 |
+
fbq("track", "AddToCart", {
|
1354 |
+
content_type : "product",
|
1355 |
+
content_name : product.tvc_n,
|
1356 |
+
content_ids : [product.tvc_id],
|
1357 |
+
currency : tvc_lc,
|
1358 |
+
value : product.tvc_p,
|
1359 |
+
contents :[{id:product.tvc_id, quantity:t_qty}]
|
1360 |
+
})
|
1361 |
+
}
|
1362 |
+
/*end facebook pixel */
|
1363 |
// Enhanced E-commerce Add to cart clicks
|
1364 |
gtag("event", "add_to_cart", {
|
1365 |
"event_category":"Enhanced-Ecommerce",
|
1615 |
return;
|
1616 |
}
|
1617 |
//call fn to make json
|
1618 |
+
$chkout_json = $this->get_ordered_items();
|
1619 |
+
$cart_total = WC()->cart->total;
|
1620 |
if($this->ga_id || $this->tracking_option == "UA" || $this->tracking_option == "BOTH") {
|
1621 |
$code= '
|
1622 |
var items = [];
|
1663 |
//check woocommerce version and add code
|
1664 |
$this->wc_version_compare($code_step_1);
|
1665 |
}
|
1666 |
+
/* facebook pixel */
|
1667 |
+
if($this->fb_pixel_id != ""){
|
1668 |
+
?>
|
1669 |
+
<script>
|
1670 |
+
var products = <?php echo json_encode($chkout_json); ?>;
|
1671 |
+
var cart_total = <?php echo json_encode($cart_total); ?>;
|
1672 |
+
|
1673 |
+
var fb_content_ids = [];
|
1674 |
+
var fb_contents = [], num_items = 0;
|
1675 |
+
for(var t_item in products){
|
1676 |
+
num_items+=parseInt(products[t_item].tvc_q);
|
1677 |
+
fb_content_ids.push(products[t_item].tvc_id);
|
1678 |
+
fb_contents.push({"id":products[t_item].tvc_id, "quantity":products[t_item].tvc_q});
|
1679 |
+
}
|
1680 |
+
fbq("track", "InitiateCheckout", {
|
1681 |
+
content_type : "product_group",
|
1682 |
+
content_name : "Checkout Page",
|
1683 |
+
content_ids : fb_content_ids,
|
1684 |
+
currency : "<?php echo esc_js($this->ga_LC); ?>",
|
1685 |
+
num_items : num_items,
|
1686 |
+
value : cart_total,
|
1687 |
+
contents : fb_contents
|
1688 |
+
})
|
1689 |
+
</script>
|
1690 |
+
<?php
|
1691 |
+
}
|
1692 |
}
|
1693 |
|
1694 |
/**
|
1809 |
//return $code;
|
1810 |
//make product data json on check out page
|
1811 |
$this->wc_version_compare("tvc_ch=" . json_encode($chkout_json) . ";");
|
1812 |
+
return $chkout_json;
|
1813 |
}
|
1814 |
}
|
public/js/tvc-ee-google-analytics.js
CHANGED
@@ -9,21 +9,6 @@
|
|
9 |
})( jQuery );
|
10 |
class TVC_Enhanced {
|
11 |
constructor(options = {}){
|
12 |
-
/*"is_admin"=>is_admin(),
|
13 |
-
"tracking_option"=>$this->tracking_option,
|
14 |
-
"property_id"=>$this->ga_id,
|
15 |
-
"measurement_id"=>$this->gm_id,
|
16 |
-
"google_ads_id"=>$this->google_ads_id,
|
17 |
-
"google_merchant_center_id"=>$this->google_merchant_id,
|
18 |
-
"o_add_gtag_snippet"=>$this->ga_ST,
|
19 |
-
"o_enhanced_e_commerce_tracking"=>$this->ga_eeT,
|
20 |
-
"o_log_step_gest_user"=>$this->ga_gUser,
|
21 |
-
"o_impression_thresold"=>$this->ga_imTh,
|
22 |
-
"o_ip_anonymization"=>$this->ga_IPA,
|
23 |
-
"o_ga_OPTOUT"=>$this->ga_OPTOUT,
|
24 |
-
"ads_tracking_id"=>$this->ads_tracking_id,
|
25 |
-
"remarketing_tags"=>$this->ads_ert,
|
26 |
-
"dynamic_remarketing_tags"=>$this->ads_edrt*/
|
27 |
this.options = {
|
28 |
tracking_option: 'UA'
|
29 |
};
|
@@ -34,7 +19,6 @@ class TVC_Enhanced {
|
|
34 |
//this.addEventBindings();
|
35 |
}
|
36 |
singleProductaddToCartEventBindings(variations_data){
|
37 |
-
// alert("call first");
|
38 |
//var single_btn = document.getElementsByClassName("single_add_to_cart_button");
|
39 |
var single_btn = document.querySelectorAll("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']");
|
40 |
if(single_btn.length > 0){
|
@@ -144,7 +128,18 @@ class TVC_Enhanced {
|
|
144 |
});
|
145 |
}
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
}
|
150 |
get_variation_data_by_id(variations_data, variation_id){
|
@@ -171,7 +166,29 @@ class TVC_Enhanced {
|
|
171 |
return p_v_title;
|
172 |
}
|
173 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
add_to_cart_click( variations_data, page_type ="Product Pages" ){
|
|
|
175 |
if(this.options.is_admin == true){
|
176 |
return;
|
177 |
}
|
@@ -198,8 +215,7 @@ class TVC_Enhanced {
|
|
198 |
varPrice = vari_data.display_regular_price;
|
199 |
}
|
200 |
}
|
201 |
-
//console.log(variation_attribute_name);
|
202 |
-
|
203 |
|
204 |
if(variation_id != ""){
|
205 |
event_label="add_to_cart_"+this.options.page_type+" | "+tvc_po.tvc_n+" | "+variation_attribute_name;
|
@@ -231,7 +247,7 @@ class TVC_Enhanced {
|
|
231 |
"name": tvc_po.tvc_n,
|
232 |
"category" :tvc_po.tvc_c,
|
233 |
"price": varPrice,
|
234 |
-
"quantity" :jQuery(
|
235 |
"list_name":this.options.page_type,
|
236 |
"list_position": 1,
|
237 |
"variant": variation_attribute_name
|
@@ -258,7 +274,6 @@ class TVC_Enhanced {
|
|
258 |
*/
|
259 |
}else if( this.options.tracking_option == "GA4" && this.options.measurement_id ){
|
260 |
try {
|
261 |
-
console.log("call GA4");
|
262 |
gtag("event", "add_to_cart", {
|
263 |
"event_category":"Enhanced-Ecommerce",
|
264 |
"event_label":"add_to_cart_click",
|
@@ -270,7 +285,7 @@ class TVC_Enhanced {
|
|
270 |
"item_category" :tvc_po.tvc_c,
|
271 |
"price":varPrice,
|
272 |
"currency": this.options.currency,
|
273 |
-
"quantity": jQuery(
|
274 |
"item_variant": variation_attribute_name,
|
275 |
"discount": tvc_po.tvc_pd,
|
276 |
"affiliation":this.options.affiliation
|
@@ -305,8 +320,121 @@ class TVC_Enhanced {
|
|
305 |
}]
|
306 |
});
|
307 |
}
|
308 |
-
}
|
309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
/*
|
311 |
* below code run on thenk you page.
|
312 |
* ( Event=> purchase )
|
@@ -316,16 +444,22 @@ class TVC_Enhanced {
|
|
316 |
return;
|
317 |
}
|
318 |
this.options.page_type="Thankyou Page";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
if(this.is_add_remarketing_tags()){
|
320 |
-
|
321 |
-
var ads_value=0;
|
322 |
-
for(var t_item in tvc_oc){
|
323 |
-
ads_value=ads_value + parseFloat(tvc_oc[t_item].tvc_p);
|
324 |
-
ads_items.push({
|
325 |
-
item_id: tvc_oc[t_item].tvc_i,
|
326 |
-
google_business_vertical: "retail"
|
327 |
-
});
|
328 |
-
}
|
329 |
gtag("event","purchase", {
|
330 |
"send_to":this.options.remarketing_snippet_id,
|
331 |
"ecomm_pagetype":"purchase",
|
@@ -336,11 +470,11 @@ class TVC_Enhanced {
|
|
336 |
|
337 |
if(this.options.google_ads_conversion_tracking == 1 && this.options.conversio_send_to != ""){
|
338 |
gtag('event', 'conversion', {
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
}
|
345 |
var last_purchase_time = this.getCookie("time_to_purchase");
|
346 |
var time_to_purchase = purchase_time - last_purchase_time;
|
@@ -494,6 +628,19 @@ class TVC_Enhanced {
|
|
494 |
});
|
495 |
}
|
496 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
}
|
498 |
getCurrentTime(){
|
499 |
if (!Date.now) {
|
@@ -535,7 +682,4 @@ class TVC_Enhanced {
|
|
535 |
eraseCookie(name) {
|
536 |
document.cookie = name +"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
|
537 |
}
|
538 |
-
static test(){
|
539 |
-
|
540 |
-
}
|
541 |
}
|
9 |
})( jQuery );
|
10 |
class TVC_Enhanced {
|
11 |
constructor(options = {}){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
this.options = {
|
13 |
tracking_option: 'UA'
|
14 |
};
|
19 |
//this.addEventBindings();
|
20 |
}
|
21 |
singleProductaddToCartEventBindings(variations_data){
|
|
|
22 |
//var single_btn = document.getElementsByClassName("single_add_to_cart_button");
|
23 |
var single_btn = document.querySelectorAll("button[class*='btn-buy-shop'],button[class*='single_add_to_cart_button'], button[class*='add_to_cart']");
|
24 |
if(single_btn.length > 0){
|
128 |
});
|
129 |
}
|
130 |
|
131 |
+
/* facebook pixel*/
|
132 |
+
if(this.options.fb_pixel_id != ""){
|
133 |
+
fbq("track", "ViewContent", {
|
134 |
+
content_type : "product",
|
135 |
+
content_name : tvc_po.tvc_n,
|
136 |
+
content_category: tvc_po.tvc_c,
|
137 |
+
content_ids : [tvc_po.tvc_id],
|
138 |
+
currency : this.options.currency,
|
139 |
+
value : tvc_po.tvc_p,
|
140 |
+
contents :[{id:tvc_po.tvc_id, quantity:1}]
|
141 |
+
})
|
142 |
+
}
|
143 |
|
144 |
}
|
145 |
get_variation_data_by_id(variations_data, variation_id){
|
166 |
return p_v_title;
|
167 |
}
|
168 |
}
|
169 |
+
add_to_cart_click_fb( product , t_qty){
|
170 |
+
//console.log("add_to_cart_click_fb", product);
|
171 |
+
if(t_qty < 0){
|
172 |
+
t_qty = 1;
|
173 |
+
}
|
174 |
+
/* facebook pixel*/
|
175 |
+
if(this.options.fb_pixel_id != ""){
|
176 |
+
fbq("track", "AddToCart", {
|
177 |
+
content_type : "product",
|
178 |
+
content_name : product.tvc_n,
|
179 |
+
content_ids : [product.tvc_id],
|
180 |
+
currency : this.options.currency,
|
181 |
+
value : product.tvc_p,
|
182 |
+
contents :[{id:product.tvc_id, quantity:t_qty}]
|
183 |
+
})
|
184 |
+
}
|
185 |
+
}
|
186 |
+
/*
|
187 |
+
* below code run while add to cart on product page.
|
188 |
+
* ( Event=> add_to_cart)
|
189 |
+
*/
|
190 |
add_to_cart_click( variations_data, page_type ="Product Pages" ){
|
191 |
+
var this_var = event.currentTarget;
|
192 |
if(this.options.is_admin == true){
|
193 |
return;
|
194 |
}
|
215 |
varPrice = vari_data.display_regular_price;
|
216 |
}
|
217 |
}
|
218 |
+
//console.log(variation_attribute_name);
|
|
|
219 |
|
220 |
if(variation_id != ""){
|
221 |
event_label="add_to_cart_"+this.options.page_type+" | "+tvc_po.tvc_n+" | "+variation_attribute_name;
|
247 |
"name": tvc_po.tvc_n,
|
248 |
"category" :tvc_po.tvc_c,
|
249 |
"price": varPrice,
|
250 |
+
"quantity" :jQuery(this_var).parent().find("input[name=quantity]").val(),
|
251 |
"list_name":this.options.page_type,
|
252 |
"list_position": 1,
|
253 |
"variant": variation_attribute_name
|
274 |
*/
|
275 |
}else if( this.options.tracking_option == "GA4" && this.options.measurement_id ){
|
276 |
try {
|
|
|
277 |
gtag("event", "add_to_cart", {
|
278 |
"event_category":"Enhanced-Ecommerce",
|
279 |
"event_label":"add_to_cart_click",
|
285 |
"item_category" :tvc_po.tvc_c,
|
286 |
"price":varPrice,
|
287 |
"currency": this.options.currency,
|
288 |
+
"quantity": jQuery(this_var).parent().find("input[name=quantity]").val(),
|
289 |
"item_variant": variation_attribute_name,
|
290 |
"discount": tvc_po.tvc_pd,
|
291 |
"affiliation":this.options.affiliation
|
320 |
}]
|
321 |
});
|
322 |
}
|
|
|
323 |
|
324 |
+
/* facebook pixel*/
|
325 |
+
if(this.options.fb_pixel_id != ""){
|
326 |
+
var quantity = jQuery(this_var).parent().find("input[name=quantity]").val();
|
327 |
+
fbq("track", "AddToCart", {
|
328 |
+
content_type : "product",
|
329 |
+
content_name : tvc_po.tvc_n,
|
330 |
+
content_ids : [tvc_po.tvc_id],
|
331 |
+
currency : this.options.currency,
|
332 |
+
value : tvc_po.tvc_p,
|
333 |
+
contents :[{id:tvc_po.tvc_id, quantity:quantity}]
|
334 |
+
})
|
335 |
+
}
|
336 |
+
}
|
337 |
+
/*
|
338 |
+
*
|
339 |
+
*/
|
340 |
+
checkout_step_1_tracking(tvc_ch, cart_total){
|
341 |
+
var fb_content_ids = [];
|
342 |
+
var fb_contents = [], num_items = 0;
|
343 |
+
for(var t_item in tvc_ch){
|
344 |
+
num_items+=parseInt(tvc_ch[t_item].tvc_q);
|
345 |
+
fb_content_ids.push(tvc_ch[t_item].tvc_id);
|
346 |
+
fb_contents.push({"id":tvc_ch[t_item].tvc_id, "quantity":tvc_ch[t_item].tvc_q});
|
347 |
+
}
|
348 |
+
if((this.options.tracking_option =="UA" || this.options.tracking_option == "BOTH") && this.options.property_id ){
|
349 |
+
try {
|
350 |
+
gtag("set", {"currency": this.options.currency});
|
351 |
+
var items = [];
|
352 |
+
for(var t_item in tvc_ch){
|
353 |
+
items.push({
|
354 |
+
"id": tvc_ch[t_item].tvc_i,
|
355 |
+
"name": tvc_ch[t_item].tvc_n,
|
356 |
+
"category": tvc_ch[t_item].tvc_c,
|
357 |
+
"attributes": tvc_ch[t_item].tvc_attr,
|
358 |
+
"price": tvc_ch[t_item].tvc_p,
|
359 |
+
"quantity": tvc_ch[t_item].tvc_q
|
360 |
+
});
|
361 |
+
}
|
362 |
+
gtag("event", "begin_checkout", {
|
363 |
+
"event_category":"Enhanced-Ecommerce",
|
364 |
+
"event_label":"checkout_step_1",
|
365 |
+
"items":items,
|
366 |
+
"non_interaction": true
|
367 |
+
});
|
368 |
+
}catch(err){
|
369 |
+
gtag("event", "exception", {
|
370 |
+
"description": err,
|
371 |
+
"fatal": false
|
372 |
+
});
|
373 |
+
}
|
374 |
+
/*
|
375 |
+
* Start GA4
|
376 |
+
*/
|
377 |
+
}else if( this.options.tracking_option == "GA4" && this.options.measurement_id ){
|
378 |
+
try {
|
379 |
+
var items = [];
|
380 |
+
for(var t_item in tvc_ch){
|
381 |
+
items.push({
|
382 |
+
"item_id": tvc_ch[t_item].tvc_i,
|
383 |
+
"currency": this.options.currency,
|
384 |
+
"item_name": tvc_ch[t_item].tvc_n,
|
385 |
+
"item_category": tvc_ch[t_item].tvc_c,
|
386 |
+
"item_variant": tvc_ch[t_item].tvc_attr,
|
387 |
+
"price": tvc_ch[t_item].tvc_p,
|
388 |
+
"quantity": tvc_ch[t_item].tvc_q
|
389 |
+
});
|
390 |
+
}
|
391 |
+
gtag("event", "begin_checkout", {
|
392 |
+
"currency": this.options.currency,
|
393 |
+
"value": cart_total,
|
394 |
+
"items":items,
|
395 |
+
"non_interaction": true
|
396 |
+
});
|
397 |
+
}catch(err){
|
398 |
+
gtag("event", "exception", {
|
399 |
+
"description": err,
|
400 |
+
"fatal": false
|
401 |
+
});
|
402 |
+
}
|
403 |
+
}
|
404 |
+
/* facebook pixel*/
|
405 |
+
if(this.options.fb_pixel_id != ""){
|
406 |
+
fbq("track", "InitiateCheckout", {
|
407 |
+
content_type : "product_group",
|
408 |
+
content_name : "Checkout Page",
|
409 |
+
content_ids : fb_content_ids,
|
410 |
+
currency : this.options.currency,
|
411 |
+
num_items : num_items,
|
412 |
+
value : cart_total,
|
413 |
+
contents : fb_contents
|
414 |
+
})
|
415 |
+
}
|
416 |
+
}
|
417 |
+
/*
|
418 |
+
* below code run on search page.
|
419 |
+
* ( Event=> search )
|
420 |
+
*/
|
421 |
+
search_page(products, keyword){
|
422 |
+
console.log(products, keyword);
|
423 |
+
/* facebook pixel*/
|
424 |
+
if(this.options.fb_pixel_id != ""){
|
425 |
+
var fb_content_ids = [];
|
426 |
+
var fb_contents = [];
|
427 |
+
for(var t_item in products){
|
428 |
+
fb_content_ids.push(products[t_item].tvc_id);
|
429 |
+
fb_contents.push({"id":products[t_item].tvc_id, "quantity":1});
|
430 |
+
}
|
431 |
+
fbq("track", "Search", {
|
432 |
+
content_ids : fb_content_ids,
|
433 |
+
currency : this.options.currency,
|
434 |
+
contents : fb_contents
|
435 |
+
})
|
436 |
+
}
|
437 |
+
}
|
438 |
/*
|
439 |
* below code run on thenk you page.
|
440 |
* ( Event=> purchase )
|
444 |
return;
|
445 |
}
|
446 |
this.options.page_type="Thankyou Page";
|
447 |
+
var fb_content_ids = [];
|
448 |
+
var fb_contents = [], num_items = 0;
|
449 |
+
var ads_items = [];
|
450 |
+
var ads_value=0;
|
451 |
+
for(var t_item in tvc_oc){
|
452 |
+
ads_value=ads_value + parseFloat(tvc_oc[t_item].tvc_p);
|
453 |
+
ads_items.push({
|
454 |
+
item_id: tvc_oc[t_item].tvc_i,
|
455 |
+
google_business_vertical: "retail"
|
456 |
+
});
|
457 |
+
num_items+=parseInt(tvc_oc[t_item].tvc_q);
|
458 |
+
fb_content_ids.push(tvc_oc[t_item].tvc_id);
|
459 |
+
fb_contents.push({"id":tvc_oc[t_item].tvc_id, "quantity":tvc_oc[t_item].tvc_q});
|
460 |
+
}
|
461 |
if(this.is_add_remarketing_tags()){
|
462 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
gtag("event","purchase", {
|
464 |
"send_to":this.options.remarketing_snippet_id,
|
465 |
"ecomm_pagetype":"purchase",
|
470 |
|
471 |
if(this.options.google_ads_conversion_tracking == 1 && this.options.conversio_send_to != ""){
|
472 |
gtag('event', 'conversion', {
|
473 |
+
'send_to': this.options.conversio_send_to,
|
474 |
+
'value': tvc_td.revenue,
|
475 |
+
'currency': this.options.currency,
|
476 |
+
'transaction_id': tvc_td.id,
|
477 |
+
});
|
478 |
}
|
479 |
var last_purchase_time = this.getCookie("time_to_purchase");
|
480 |
var time_to_purchase = purchase_time - last_purchase_time;
|
628 |
});
|
629 |
}
|
630 |
}
|
631 |
+
|
632 |
+
/* facebook pixel*/
|
633 |
+
if(this.options.fb_pixel_id != ""){
|
634 |
+
fbq("track", "Purchase", {
|
635 |
+
content_type : "product_group",
|
636 |
+
content_name : "Thankyou Page",
|
637 |
+
content_ids : fb_content_ids,
|
638 |
+
currency : this.options.currency,
|
639 |
+
num_items : num_items,
|
640 |
+
value : tvc_td.revenue,
|
641 |
+
contents : fb_contents
|
642 |
+
})
|
643 |
+
}
|
644 |
}
|
645 |
getCurrentTime(){
|
646 |
if (!Date.now) {
|
682 |
eraseCookie(name) {
|
683 |
document.cookie = name +"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
|
684 |
}
|
|
|
|
|
|
|
685 |
}
|
readme.txt
CHANGED
@@ -6,10 +6,10 @@ Tags: Google Analytics tracking, Dynamic Remarketing, Google Shopping automation
|
|
6 |
Author URI: https://conversios.io/
|
7 |
Author: Tatvic
|
8 |
Requires at least: 3.5.0
|
9 |
-
Tested up to: 5.9.
|
10 |
Requires PHP: 5.6 or Higher
|
11 |
-
Stable tag: 4.
|
12 |
-
Version: 4.
|
13 |
License: GPLv3
|
14 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
15 |
|
@@ -132,9 +132,12 @@ Enhanced eCommerce Google analytics plugin tracks the entire user journey on you
|
|
132 |
13. Automatic site verification and domain claim for Google Merchant Center account
|
133 |
14. Seamless product sync from wordpress backend to Google Merchant Center account in order to opt for Surfaces across Google and Google Shopping.
|
134 |
15. Automatic price and inventory update for your WooCommerce products to Merchant Center account
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
138 |
|
139 |
<strong><a target="_blank" href="https://conversios.io/pricings/?utm_source=EE+Plugin+Wordpress+Listing&utm_medium=Below+Free+Features&utm_campaign=Upsell+at+Conversios"> Fast track and scale your eCommerce business to new heights by unlocking more advanced tracking and enabling complete google shopping solutions for your WooCommerce store. Give a try to our pro version.</a></strong>
|
140 |
|
@@ -379,6 +382,10 @@ You can resolve the duplication of data by removing the manually implemented GA
|
|
379 |
|
380 |
|
381 |
== Changelog ==
|
|
|
|
|
|
|
|
|
382 |
= 4.6.9 - 21/03/2022 =
|
383 |
* Fix: - Site verification issue for some users.
|
384 |
|
6 |
Author URI: https://conversios.io/
|
7 |
Author: Tatvic
|
8 |
Requires at least: 3.5.0
|
9 |
+
Tested up to: 5.9.2
|
10 |
Requires PHP: 5.6 or Higher
|
11 |
+
Stable tag: 4.7.0
|
12 |
+
Version: 4.7.0
|
13 |
License: GPLv3
|
14 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
15 |
|
132 |
13. Automatic site verification and domain claim for Google Merchant Center account
|
133 |
14. Seamless product sync from wordpress backend to Google Merchant Center account in order to opt for Surfaces across Google and Google Shopping.
|
134 |
15. Automatic price and inventory update for your WooCommerce products to Merchant Center account
|
135 |
+
16. Smart Shopping Campaign creation and management from Wordpress backend
|
136 |
+
17. Shopping campaign performance dashboard
|
137 |
+
18. Product Sync dashboard
|
138 |
+
19. Facebook Pixel Conversion Tracking
|
139 |
+
20. Compaible with "YITH Woocommerce brand" plugin
|
140 |
+
21. Compatible with Multi Currency plugins like "WOOCS", "CURCY – Multi-Currency for WooCommerce" and "WBW Currency Switcher for WooCommerce"
|
141 |
|
142 |
<strong><a target="_blank" href="https://conversios.io/pricings/?utm_source=EE+Plugin+Wordpress+Listing&utm_medium=Below+Free+Features&utm_campaign=Upsell+at+Conversios"> Fast track and scale your eCommerce business to new heights by unlocking more advanced tracking and enabling complete google shopping solutions for your WooCommerce store. Give a try to our pro version.</a></strong>
|
143 |
|
382 |
|
383 |
|
384 |
== Changelog ==
|
385 |
+
= 4.7.0 - 05/04/2022 =
|
386 |
+
* New: Facebook Pixel conversion tracking for major ecommerce events like Page view, Add to Cart, Initiate checkout, Purchase, View Content and Search events.
|
387 |
+
* New: Compatible with Multi Currency plugins like "WOOCS", "CURCY – Multi-Currency for WooCommerce" and "WBW Currency Switcher for WooCommerce"
|
388 |
+
|
389 |
= 4.6.9 - 21/03/2022 =
|
390 |
* Fix: - Site verification issue for some users.
|
391 |
|