What are some best practices for adding external scripts, such as Google Plus buttons, to a WordPress site without causing header modification errors?

When adding external scripts, such as Google Plus buttons, to a WordPress site, it's important to avoid directly modifying the header.php file as it can lead to errors and conflicts with other plugins or themes. Instead, a better approach is to enqueue the script using WordPress's built-in functions to ensure proper loading and compatibility.

function add_google_plus_script() {
    wp_enqueue_script( 'google-plus-script', 'https://apis.google.com/js/platform.js', array(), null, true );
}
add_action( 'wp_enqueue_scripts', 'add_google_plus_script' );