Store value in cookie
Use setcookie() like shown below: setcookie( $name, $value, time() + 3600, COOKIEPATH, COOKIE_DOMAIN ); Note: $wpdb->insert_id AFAIK will always return false or 1, so I’m not sure if that will be of value for your. I might be wrong about that see @s_ha_dum’s comment.