PluginProbe
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder / 51.1.78
King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder v51.1.78
51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 51.1.47 51.1.49 All 37 releases
king-addons / includes / extensions / Fomo_Notifications / templates / admin-analytics.php

admin-analytics.php in King Addons for Elementor – 80+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce, Mega Menu, Popup Builder 51.1.78, at includes/extensions/Fomo_Notifications/templates/admin-analytics.php

215 lines 14.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Fomo Notifications - Analytics Template
4 *
5 * @package King_Addons
6 */
7
8 defined('ABSPATH') || exit;
9
10 $is_pro = king_addons_freemius()->can_use_premium_code();
11 $stats = King_Addons\Fomo_Notifications::instance()->get_total_stats();
12
13 // Get top performing notifications
14 $top_notifications = get_posts([
15 'post_type' => 'kng_fomo_notif',
16 'posts_per_page' => 10,
17 'meta_key' => '_kng_fomo_clicks',
18 'orderby' => 'meta_value_num',
19 'order' => 'DESC'
20 ]);
21 ?>
22
23 <div class="kng-fomo-admin">
24
25 <!-- Navigation -->
26 <nav class="kng-fomo-nav">
27 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-fomo')); ?>" class="kng-fomo-nav-item">
28 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="9"></rect><rect x="14" y="3" width="7" height="5"></rect><rect x="14" y="12" width="7" height="9"></rect><rect x="3" y="16" width="7" height="5"></rect></svg>
29 <?php esc_html_e('Dashboard', 'king-addons'); ?>
30 </a>
31 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-fomo&view=list')); ?>" class="kng-fomo-nav-item">
32 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>
33 <?php esc_html_e('Notifications', 'king-addons'); ?>
34 </a>
35 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-fomo&view=wizard')); ?>" class="kng-fomo-nav-item">
36 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>
37 <?php esc_html_e('Add New', 'king-addons'); ?>
38 </a>
39 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-fomo&view=analytics')); ?>" class="kng-fomo-nav-item is-active">
40 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"></line><line x1="12" y1="20" x2="12" y2="4"></line><line x1="6" y1="20" x2="6" y2="14"></line></svg>
41 <?php esc_html_e('Analytics', 'king-addons'); ?>
42 </a>
43 <a href="<?php echo esc_url(admin_url('admin.php?page=king-addons-fomo&view=settings')); ?>" class="kng-fomo-nav-item">
44 <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
45 <?php esc_html_e('Settings', 'king-addons'); ?>
46 </a>
47 </nav>
48
49 <!-- Page Header -->
50 <div class="kng-fomo-section">
51 <div class="kng-fomo-section-header">
52 <div>
53 <h1 class="kng-fomo-section-title"><?php esc_html_e('Analytics', 'king-addons'); ?></h1>
54 <p class="kng-fomo-section-subtitle"><?php esc_html_e('Track the performance of your notifications', 'king-addons'); ?></p>
55 </div>
56 <div class="kng-fomo-chart-filters">
57 <select class="kng-fomo-select kng-fomo-input--sm kng-fomo-date-range" style="width: auto;">
58 <option value="7days"><?php esc_html_e('Last 7 Days', 'king-addons'); ?></option>
59 <option value="30days"><?php esc_html_e('Last 30 Days', 'king-addons'); ?></option>
60 <option value="90days"><?php esc_html_e('Last 90 Days', 'king-addons'); ?></option>
61 <option value="year"><?php esc_html_e('This Year', 'king-addons'); ?></option>
62 </select>
63 </div>
64 </div>
65 </div>
66
67 <!-- KPIs -->
68 <div class="kng-fomo-kpis">
69 <div class="kng-fomo-kpi">
70 <div class="kng-fomo-kpi-icon kng-fomo-kpi-icon--views">
71 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>
72 </div>
73 <div class="kng-fomo-kpi-value" data-kpi="views"><?php echo esc_html(number_format_i18n($stats['views'])); ?></div>
74 <div class="kng-fomo-kpi-label"><?php esc_html_e('Total Views', 'king-addons'); ?></div>
75 <?php if ($stats['views_change'] != 0): ?>
76 <span class="kng-fomo-kpi-change kng-fomo-kpi-change--<?php echo $stats['views_change'] > 0 ? 'up' : 'down'; ?>">
77 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="<?php echo $stats['views_change'] > 0 ? '18 15 12 9 6 15' : '6 9 12 15 18 9'; ?>"></polyline></svg>
78 <?php echo esc_html(abs($stats['views_change']) . '%'); ?>
79 </span>
80 <?php endif; ?>
81 </div>
82
83 <div class="kng-fomo-kpi">
84 <div class="kng-fomo-kpi-icon kng-fomo-kpi-icon--clicks">
85 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12h-4l-3 9L9 3l-3 9H2"></path></svg>
86 </div>
87 <div class="kng-fomo-kpi-value" data-kpi="clicks"><?php echo esc_html(number_format_i18n($stats['clicks'])); ?></div>
88 <div class="kng-fomo-kpi-label"><?php esc_html_e('Total Clicks', 'king-addons'); ?></div>
89 <?php if ($stats['clicks_change'] != 0): ?>
90 <span class="kng-fomo-kpi-change kng-fomo-kpi-change--<?php echo $stats['clicks_change'] > 0 ? 'up' : 'down'; ?>">
91 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="<?php echo $stats['clicks_change'] > 0 ? '18 15 12 9 6 15' : '6 9 12 15 18 9'; ?>"></polyline></svg>
92 <?php echo esc_html(abs($stats['clicks_change']) . '%'); ?>
93 </span>
94 <?php endif; ?>
95 </div>
96
97 <div class="kng-fomo-kpi">
98 <div class="kng-fomo-kpi-icon kng-fomo-kpi-icon--ctr">
99 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>
100 </div>
101 <div class="kng-fomo-kpi-value" data-kpi="ctr"><?php echo esc_html($stats['ctr'] . '%'); ?></div>
102 <div class="kng-fomo-kpi-label"><?php esc_html_e('Click-Through Rate', 'king-addons'); ?></div>
103 </div>
104 </div>
105
106 <!-- Chart -->
107 <div class="kng-fomo-section">
108 <div class="kng-fomo-chart-wrap">
109 <div class="kng-fomo-chart-header">
110 <h3 class="kng-fomo-chart-title"><?php esc_html_e('Performance Over Time', 'king-addons'); ?></h3>
111 </div>
112 <div class="kng-fomo-chart-canvas">
113 <canvas id="kng-fomo-chart"></canvas>
114 </div>
115 </div>
116 </div>
117
118 <!-- Top Performing -->
119 <?php if (!empty($top_notifications)): ?>
120 <div class="kng-fomo-section">
121 <div class="kng-fomo-section-header">
122 <div>
123 <h2 class="kng-fomo-section-title"><?php esc_html_e('Top Performing Notifications', 'king-addons'); ?></h2>
124 <p class="kng-fomo-section-subtitle"><?php esc_html_e('Notifications with the most engagement', 'king-addons'); ?></p>
125 </div>
126 </div>
127
128 <div class="kng-fomo-table-wrap">
129 <table class="kng-fomo-table">
130 <thead>
131 <tr>
132 <th><?php esc_html_e('Notification', 'king-addons'); ?></th>
133 <th><?php esc_html_e('Type', 'king-addons'); ?></th>
134 <th><?php esc_html_e('Views', 'king-addons'); ?></th>
135 <th><?php esc_html_e('Clicks', 'king-addons'); ?></th>
136 <th><?php esc_html_e('CTR', 'king-addons'); ?></th>
137 <th><?php esc_html_e('Status', 'king-addons'); ?></th>
138 </tr>
139 </thead>
140 <tbody>
141 <?php foreach ($top_notifications as $notification):
142 $type = get_post_meta($notification->ID, '_kng_fomo_type', true);
143 $status = get_post_meta($notification->ID, '_kng_fomo_status', true) ?: 'disabled';
144 $views = (int) get_post_meta($notification->ID, '_kng_fomo_views', true);
145 $clicks = (int) get_post_meta($notification->ID, '_kng_fomo_clicks', true);
146 $ctr = $views > 0 ? round(($clicks / $views) * 100, 1) : 0;
147 ?>
148 <tr>
149 <td>
150 <div class="kng-fomo-table-title">
151 <span class="kng-fomo-table-preview">
152 <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>
153 </span>
154 <?php echo esc_html($notification->post_title); ?>
155 </div>
156 </td>
157 <td><?php echo esc_html(ucfirst(str_replace('_', ' ', $type))); ?></td>
158 <td><?php echo esc_html(number_format_i18n($views)); ?></td>
159 <td><?php echo esc_html(number_format_i18n($clicks)); ?></td>
160 <td>
161 <span style="color: <?php echo $ctr >= 5 ? 'var(--kng-fomo-success)' : ($ctr >= 2 ? 'var(--kng-fomo-warning)' : 'var(--kng-fomo-text-secondary)'); ?>; font-weight: 600;">
162 <?php echo esc_html($ctr . '%'); ?>
163 </span>
164 </td>
165 <td>
166 <span class="kng-fomo-status kng-fomo-status--<?php echo esc_attr($status); ?>">
167 <span class="kng-fomo-status-dot"></span>
168 <?php echo $status === 'enabled' ? esc_html__('Active', 'king-addons') : esc_html__('Inactive', 'king-addons'); ?>
169 </span>
170 </td>
171 </tr>
172 <?php endforeach; ?>
173 </tbody>
174 </table>
175 </div>
176 </div>
177 <?php endif; ?>
178
179 <!-- Pro Upsell (for advanced analytics) -->
180 <?php if (!$is_pro): ?>
181 <div class="kng-fomo-upsell">
182 <div class="kng-fomo-upsell-content">
183 <span class="kng-fomo-upsell-badge">
184 <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
185 <?php esc_html_e('Pro', 'king-addons'); ?>
186 </span>
187 <h3 class="kng-fomo-upsell-title"><?php esc_html_e('Advanced Analytics', 'king-addons'); ?></h3>
188 <p class="kng-fomo-upsell-desc"><?php esc_html_e('Get detailed analytics with conversion tracking, A/B testing results, geographic data, device breakdown, and more.', 'king-addons'); ?></p>
189 <div class="kng-fomo-upsell-features">
190 <span class="kng-fomo-upsell-feature">
191 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
192 <?php esc_html_e('Conversion Tracking', 'king-addons'); ?>
193 </span>
194 <span class="kng-fomo-upsell-feature">
195 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
196 <?php esc_html_e('Device Breakdown', 'king-addons'); ?>
197 </span>
198 <span class="kng-fomo-upsell-feature">
199 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
200 <?php esc_html_e('Export Reports', 'king-addons'); ?>
201 </span>
202 </div>
203 <a href="<?php echo esc_url(king_addons_freemius()->get_upgrade_url()); ?>" class="kng-fomo-btn kng-fomo-btn--primary">
204 <?php esc_html_e('Upgrade to Pro', 'king-addons'); ?>
205 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>
206 </a>
207 </div>
208 </div>
209 <?php endif; ?>
210
211 </div>
212
213 <!-- Chart.js -->
214 <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
215