getting id of page

I think this is what you want:

$qobj = get_queried_object();
var_dump($qobj->term_id);

get_queried_object will get information about the current page. That information varies by type and content for different pages but on a taxonomy page it will give you a stdClass object with taxonomy data related to that page..