Skip to content

Commit 626e472

Browse files
committed
new_version_1.0.4
1 parent 09554b1 commit 626e472

9 files changed

Lines changed: 260 additions & 185 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

AI-Analytics/css/admin-styles.css

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* admin-styles.css */
2+
.fake-header {
3+
display: none;
4+
}
5+
.container {
6+
max-width: 40rem;
7+
margin-left: auto;
8+
margin-right: auto;
9+
}
10+
.header-container {
11+
display: flex;
12+
gap: 1rem;
13+
align-items: center;
14+
margin-top: 2rem;
15+
margin-bottom: 1rem;
16+
}
17+
.header-container img {
18+
height: 2rem;
19+
}
20+
.header-container h1 {
21+
padding: 0;
22+
}
23+
.header-container a {
24+
margin-left: auto;
25+
}
26+
h1 {
27+
font-weight: bold !important;
28+
}
29+
h2 {
30+
font-weight: bold;
31+
}
32+
hr {
33+
border: none;
34+
height: 1px;
35+
background-color: rgba(0, 0, 0, 0.2);
36+
margin-top: 1rem;
37+
margin-bottom: 1rem;
38+
}
39+
input[type="text"] {
40+
width: 100%;
41+
}
42+
input[type="checkbox"]:disabled {
43+
border-color: revert;
44+
opacity: revert;
45+
}
46+
table {
47+
width: 100%;
48+
border-collapse: collapse;
49+
text-align: left;
50+
}
51+
table, th, td {
52+
border: 1px solid rgba(0, 0, 0, 0.2);
53+
}
54+
th, td {
55+
padding: 1rem;
56+
}
57+
th {
58+
background-color: rgba(0, 0, 0, 0.05);
59+
}
60+
td p {
61+
color: rgba(0, 0, 0, 0.5);
62+
}
63+
td p:first-child {
64+
margin-top: 0;
65+
}
66+
td p:last-child {
67+
margin-bottom: 0;
68+
}
69+
.table-header-step-number-label {
70+
margin-bottom: 0.5rem;
71+
}
72+
.table-header-step-text-label {
73+
font-weight: normal;
74+
}

AI-Analytics/includes/analytics.php

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23

34
// Server Analytics
45

@@ -39,43 +40,54 @@ function smalk_send_visit_request() {
3940
// Client Analytics
4041

4142
function smalk_add_analytics_script_tag() {
42-
$should_add_analytics_script_tag = smalk_is_analytics_enabled_and_allowed();
43-
44-
if ($should_add_analytics_script_tag) {
43+
if ( smalk_is_analytics_enabled_and_allowed() ) {
4544
$project_id = smalk_get_user_analytics_script_tag();
46-
47-
if (!empty($project_id)) {
48-
// Register the script first
45+
if ( !empty($project_id) ) {
46+
// Register the script.
4947
wp_register_script(
5048
'smalk-analytics',
5149
"https://api.smalk.ai/tracker.js?PROJECT_KEY={$project_id}",
5250
array(),
5351
SMALK_AI_WORDPRESS_PLUGIN_VERSION,
54-
false // Place in head
52+
false // Load in head.
5553
);
5654

57-
// Use the wp_print_scripts action to add the comment right before our script
58-
add_action('wp_print_scripts', function() {
59-
echo "\n<!-- Smalk AI Agent Analytics (https://www.smalk.ai) -->\n";
60-
}, 1); // Priority 9 to ensure it runs before the script
55+
// Add inline JavaScript (a comment in this case) using wp_add_inline_script.
56+
wp_add_inline_script(
57+
'smalk-analytics',
58+
'/* Smalk AI Agent Analytics (https://www.smalk.ai) */',
59+
'before'
60+
);
6161

62-
// Enqueue the script
62+
// Enqueue the script.
6363
wp_enqueue_script('smalk-analytics');
6464
}
6565
}
6666
}
67-
68-
// Use wp_enqueue_scripts hook to register and enqueue
6967
add_action('wp_enqueue_scripts', 'smalk_add_analytics_script_tag', 1);
7068

7169
// Helpers
7270

7371
function smalk_get_request_headers() {
7472
$header_names = [
73+
// User Agent Information
7574
'User-Agent',
75+
'Sec-Ch-Ua', // Browser brand and version
76+
'Sec-Ch-Ua-Platform', // Operating system
77+
// Navigation & Referral
7678
'Referer',
79+
'Origin',
7780
'From',
81+
// Language & Locale
82+
'Accept-Language',
83+
'Content-Language',
84+
// Geolocation Headers
7885
'X-Country-Code',
86+
'CF-IPCountry', // Cloudflare country code
87+
'X-Geo-Country', // Generic geo country header
88+
'X-Geo-City', // City information
89+
'X-Geo-Region', // Region/State information
90+
// IP-related Headers
7991
'Remote-Addr',
8092
'X-Forwarded-For',
8193
'X-Real-IP',
@@ -86,7 +98,10 @@ function smalk_get_request_headers() {
8698
'X-Original-Forwarded-For',
8799
'Fastly-Client-IP',
88100
'True-Client-IP',
89-
'X-Appengine-User-IP'
101+
'X-Appengine-User-IP',
102+
// Connection Information
103+
'Connection',
104+
'Via' // Proxy information
90105
];
91106

92107
$request_headers = [];

AI-Analytics/includes/constants.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23

34
// General
45

AI-Analytics/includes/cron.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
23

34
// Custom Intervals
45

0 commit comments

Comments
 (0)