PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / includes / core / compatibility / plugin / class-wpfnl-google-site-kit.php

class-wpfnl-google-site-kit.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at includes/core/compatibility/plugin/class-wpfnl-google-site-kit.php

72 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GoogleSiteKit Compatibility
4 * Google Site Kit is doing conversion tracking using query parameters
5 * Keys are different in Google Site Kit and WPFunnels
6 * This class is responsible for updating the query parameters for Google Site Kit
7 *
8 * @package WPFunnels\Compatibility\Plugin
9 */
10 namespace WPFunnels\Compatibility\Plugin;
11
12 use WPFunnels\Wpfnl_functions;
13 use WPFunnels\Traits\SingletonTrait;
14
15 /**
16 * Google Site Kit Compatibility
17 *
18 * @package WPFunnels\Compatibility
19 */
20 class GoogleSiteKit extends PluginCompatibility{
21 use SingletonTrait;
22
23 /**
24 * Implement Filters/Hooks
25 * to initiate the necessary updates.
26 *
27 * @since 3.4.13
28 */
29 public function init() {
30
31 add_filter( 'wpfunnels/update_query_param', array( $this, 'update_query_param'), 10 );
32 add_filter( 'wpfunnels/prepare_query_param', array( $this, 'update_query_param'), 10 );
33 add_filter( 'wpfunnels/order_meta', array( $this, 'update_query_param'), 10 );
34 }
35
36
37 /**
38 * Updates the query parameters
39 * This function checks if the 'wpfnl-key' parameter is set in the given array
40 * If it is, the function add new param 'key' with the same value of 'wpfnl-key' and returns the updated array
41 * If 'wpfnl-key' is not set, the function returns the original array without any changes.
42 *
43 * @param array $query_param
44 *
45 * @return array
46 *
47 * @since 3.4.13
48 */
49 public function update_query_param( $query_param ) {
50 if( isset( $query_param['wpfnl-key'] )){
51 $query_param['key'] = $query_param['wpfnl-key'];
52 }
53 return $query_param;
54 }
55
56
57
58 /**
59 * Check if Google Site Kit is activated
60 * Checked out the constant 'GOOGLESITEKIT_PLUGIN_MAIN_FILE' is defined or not
61 * If not defined, the plugin is not activated and will return false
62 * If defined, the plugin is activated and will return true
63 *
64 * @return bool
65 * @since 3.4.13
66 */
67 public function maybe_activate()
68 {
69 return defined('GOOGLESITEKIT_PLUGIN_MAIN_FILE');
70 }
71 }
72