Skip to content

Commit df7546d

Browse files
committed
fix session feedback
1 parent 9efd42f commit df7546d

1 file changed

Lines changed: 2 additions & 28 deletions

File tree

includes/common/class-path-pilot-shared.php

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -203,38 +203,13 @@ public static function handle_event( $request ) {
203203
if (!isset($_SESSION['path_pilot_paths'])) {
204204
$_SESSION['path_pilot_paths'] = [];
205205
}
206-
if (!isset($_SESSION['path_pilot_metadata'])) {
207-
$_SESSION['path_pilot_metadata'] = [];
208-
}
209-
$paths = isset($_SESSION['path_pilot_paths'][$sid]) ? $_SESSION['path_pilot_paths'][$sid] : [];
206+
207+
$paths = isset($_SESSION['path_pilot_paths'][$sid]) ? array_map('intval', $_SESSION['path_pilot_paths'][$sid]) : [];
210208
if ($post_id > 0 && (empty($paths) || end($paths) != $post_id)) {
211209
$paths[] = $post_id;
212210
}
213211
$_SESSION['path_pilot_paths'][$sid] = $paths;
214212

215-
// Store/update metadata in session
216-
$metadata = [
217-
'device_type' => $device,
218-
'referrer' => $referrer,
219-
'screen_width' => $screen_w,
220-
'screen_height' => $screen_h,
221-
'browser_name' => $browser_name,
222-
'browser_version' => $browser_version,
223-
'os_name' => $os_name,
224-
'time_on_page' => $time_on_page,
225-
'entrance' => $entrance,
226-
'exit' => $exit,
227-
'scroll_depth' => $scroll_depth,
228-
'viewport_width' => $viewport_width,
229-
'viewport_height' => $viewport_height
230-
];
231-
if (isset($params['metadata']) && is_array($params['metadata'])) {
232-
foreach ($params['metadata'] as $key => $value) {
233-
$metadata['custom_' . sanitize_key($key)] = $value;
234-
}
235-
}
236-
$_SESSION['path_pilot_metadata'][$sid] = $metadata;
237-
238213
// Determine if this is a goal or conversion page
239214
$is_goal_page = false;
240215
$is_conversion_page = false;
@@ -649,7 +624,6 @@ public static function track_goal_completion($session_id) {
649624

650625
// Clear the session path and metadata for this session after a completion (goal or explicit)
651626
unset($_SESSION['path_pilot_paths'][$session_id]);
652-
unset($_SESSION['path_pilot_metadata'][$session_id]);
653627
return true;
654628
}
655629

0 commit comments

Comments
 (0)