Check if current page is admin page
if (service('router.admin_context')->isAdminRoute(\Drupal::routeMatch()->getRouteObject())) {
...
}
Get current node type
$node = \Drupal::routeMatch()->getParameter('node');
dsm($node->bundle());
if (isset($node) && $node->bundle() == 'article') {
dsm($node->bundle());
}