| 1 |
<?php |
| 2 |
/** |
| 3 |
* Extension Abstract |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Types; |
| 9 |
use NotificationX\GetInstance; |
| 10 |
use NotificationX\Modules; |
| 11 |
|
| 12 |
/** |
| 13 |
* Extension Abstract for all Extension. |
| 14 |
* @method static PageAnalytics get_instance($args = null) |
| 15 |
*/ |
| 16 |
class PageAnalytics extends Types { |
| 17 |
/** |
| 18 |
* Instance of Admin |
| 19 |
* |
| 20 |
* @var Admin |
| 21 |
*/ |
| 22 |
use GetInstance; |
| 23 |
|
| 24 |
public $priority = 70; |
| 25 |
public $is_pro = true; |
| 26 |
public $module = ['modules_google_analytics']; |
| 27 |
public $default_source = 'google'; |
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* Initially Invoked when initialized. |
| 32 |
*/ |
| 33 |
public function __construct(){ |
| 34 |
parent::__construct(); |
| 35 |
$this->id = 'page_analytics'; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Runs when modules is enabled. |
| 40 |
* |
| 41 |
* @return void |
| 42 |
*/ |
| 43 |
public function init(){ |
| 44 |
parent::init(); |
| 45 |
$this->title = __('Page Analytics', 'notificationx'); |
| 46 |
$this->popup = [ |
| 47 |
"denyButtonText" => __("<a href='https://notificationx.com/docs/google-analytics/' target='_blank'>More Info</a>", "notificationx"), |
| 48 |
"confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"), |
| 49 |
"html"=> __(' |
| 50 |
<span>Connect Google Analytics to display the total number of real-time site visitors</span> |
| 51 |
<video id="pro_alert_video_popup" type="text/html" allowfullscreen width="450" height="235" autoplay loop muted> |
| 52 |
<source src="https://notificationx.com/wp-content/uploads/2024/01/Google-Analytics-Integration-With-NotificationX-How-To-Show-Active-Users-Traffic-in-WordPress.mp4" type="video/mp4"> |
| 53 |
</video> |
| 54 |
', 'notificationx') |
| 55 |
]; |
| 56 |
$this->themes = [ |
| 57 |
'pa-theme-one' => [ |
| 58 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/ga-theme-one.jpg', |
| 59 |
'template' => [ |
| 60 |
'first_param' => 'tag_siteview', |
| 61 |
'second_param' => __('marketers', 'notificationx'), |
| 62 |
'third_param' => 'ga_title', |
| 63 |
'custom_third_param' => __('Surfed this page', 'notificationx'), |
| 64 |
'ga_fourth_param' => __('in last ', 'notificationx'), |
| 65 |
'ga_fifth_param' => __('30', 'notificationx'), |
| 66 |
'sixth_param' => 'tag_day', |
| 67 |
], |
| 68 |
'defaults' => [ |
| 69 |
'link_button' => false, |
| 70 |
'link_type' => 'none', |
| 71 |
'show_default_image' => true, |
| 72 |
], |
| 73 |
], |
| 74 |
'pa-theme-two' => [ |
| 75 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/pa-theme-one.png', |
| 76 |
'image_shape' => 'rounded', |
| 77 |
'template' => [ |
| 78 |
'first_param' => 'tag_siteview', |
| 79 |
'second_param' => __('people visited', 'notificationx'), |
| 80 |
'third_param' => 'ga_title', |
| 81 |
'custom_third_param' => __('this page', 'notificationx'), |
| 82 |
'ga_fourth_param' => __('in last ', 'notificationx'), |
| 83 |
'ga_fifth_param' => __('1', 'notificationx'), |
| 84 |
'sixth_param' => 'tag_day', |
| 85 |
], |
| 86 |
'defaults' => [ |
| 87 |
'link_button' => false, |
| 88 |
'link_type' => 'none', |
| 89 |
'show_default_image' => true, |
| 90 |
], |
| 91 |
], |
| 92 |
'pa-theme-three' => [ |
| 93 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/pa-theme-two.png', |
| 94 |
'image_shape' => 'circle', |
| 95 |
'template' => [ |
| 96 |
'first_param' => 'tag_realtime_siteview', |
| 97 |
'second_param' => __('people looking', 'notificationx'), |
| 98 |
'third_param' => 'ga_title', |
| 99 |
'custom_third_param' => __('this deal', 'notificationx'), |
| 100 |
'ga_fourth_param' => __('right now', 'notificationx'), |
| 101 |
// need to set this two param unless they won't show up when changing the first param. |
| 102 |
'ga_fifth_param' => __('30', 'notificationx'), |
| 103 |
'sixth_param' => 'tag_day', |
| 104 |
], |
| 105 |
'defaults' => [ |
| 106 |
'link_button' => false, |
| 107 |
'link_type' => 'none', |
| 108 |
'show_default_image' => true, |
| 109 |
], |
| 110 |
], |
| 111 |
'pa-theme-four' => [ |
| 112 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/analytics/pa-theme-four.png', |
| 113 |
'image_shape' => 'circle', |
| 114 |
'template' => [ |
| 115 |
'first_param' => 'tag_current_page_view', |
| 116 |
'second_param' => __('People Is Now Visiting', 'notificationx'), |
| 117 |
'third_param' => 'tag_custom', |
| 118 |
'custom_third_param' => __('Holiday Deal Page', 'notificationx'), |
| 119 |
'ga_fourth_param' => __('Check out now & grab exceptional deals', 'notificationx'), |
| 120 |
// need to set this two param unless they won't show up when changing the first param. |
| 121 |
'ga_fifth_param' => __('30', 'notificationx'), |
| 122 |
'sixth_param' => 'tag_day', |
| 123 |
], |
| 124 |
'defaults' => [ |
| 125 |
'link_button_text' => __('Grab Now','notificationx'), |
| 126 |
'link_button' => true, |
| 127 |
'link_type' => 'custom', |
| 128 |
'custom_url' => '#', |
| 129 |
'show_default_image' => true, |
| 130 |
], |
| 131 |
], |
| 132 |
]; |
| 133 |
$this->res_themes = [ |
| 134 |
'res-pa-theme-one' => [ |
| 135 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-1.png', |
| 136 |
'is_pro' => true, |
| 137 |
], |
| 138 |
'res-pa-theme-two' => [ |
| 139 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-2.png', |
| 140 |
'is_pro' => true, |
| 141 |
], |
| 142 |
'res-pa-theme-three' => [ |
| 143 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-3.png', |
| 144 |
'is_pro' => true, |
| 145 |
], |
| 146 |
'res-pa-theme-four' => [ |
| 147 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/res_analytics/ga-res-theme-4.png', |
| 148 |
'is_pro' => true, |
| 149 |
], |
| 150 |
]; |
| 151 |
$this->templates = [ |
| 152 |
'pa_template_new' => [ |
| 153 |
'first_param' => [ |
| 154 |
'tag_siteview' => __('Total Site View', 'notificationx'), |
| 155 |
'tag_realtime_siteview' => __('Realtime site view', 'notificationx') |
| 156 |
], |
| 157 |
'third_param' => [ |
| 158 |
'ga_title' => __('Site Title', 'notificationx'), |
| 159 |
], |
| 160 |
'sixth_param' => [ |
| 161 |
'tag_day' => __('Day', 'notificationx'), |
| 162 |
'tag_month' => __('Month', 'notificationx'), |
| 163 |
'tag_year' => __('Year', 'notificationx'), |
| 164 |
], |
| 165 |
'_themes' => [ |
| 166 |
'page_analytics_pa-theme-one', |
| 167 |
'page_analytics_pa-theme-two', |
| 168 |
'page_analytics_pa-theme-three', |
| 169 |
], |
| 170 |
], |
| 171 |
'pa_template_current_page_view' => [ |
| 172 |
'first_param' => [ |
| 173 |
'tag_current_page_view' => __('Current Page View', 'notificationx') |
| 174 |
], |
| 175 |
'third_param' => [ |
| 176 |
'tag_ga_page_title' => __('Page Title', 'notificationx'), |
| 177 |
], |
| 178 |
'sixth_param' => [ |
| 179 |
'tag_day' => __('Day', 'notificationx'), |
| 180 |
'tag_month' => __('Month', 'notificationx'), |
| 181 |
'tag_year' => __('Year', 'notificationx'), |
| 182 |
], |
| 183 |
'_themes' => [ |
| 184 |
'page_analytics_pa-theme-four', |
| 185 |
], |
| 186 |
], |
| 187 |
]; |
| 188 |
} |
| 189 |
|
| 190 |
public function preview_entry($entry, $settings){ |
| 191 |
$entry = array_merge($entry, [ |
| 192 |
"title" => "WPDeveloper", |
| 193 |
|
| 194 |
]); |
| 195 |
return $entry; |
| 196 |
} |
| 197 |
|
| 198 |
|
| 199 |
} |
| 200 |
|