Hot Jupiters (HJs) are usually defined as giant Jovian-size planets with orbital periods P⩽10 days. Although they lie close to the star, several have finite eccentricities and significant misalignment angle with respect to the stellar equator, leading to ~20% of HJs in retrograde orbits. More than half, however, seem consistent with near-circular and planar orbits. In recent years, two mechanisms have been proposed to explain the excited and misaligned subpopulation of HJs: Lidov–Kozai migration and planet–planet scattering. Although both are based on completely different dynamical phenomena, at first hand they appear to be equally effective in generating hot planets. Nevertheless, there has been no detailed analysis comparing the predictions of both mechanisms, especially with respect to the final distribution of orbital characteristics. In this paper, we present a series of numerical simulations of Lidov–Kozai trapping of single planets in compact binary systems that suffered a close fly-by of a background star. Both the planet and the binary component are initially placed in coplanar orbits, although the inclination of the impactor is assumed random. After the passage of the third star, we follow the orbital and spin evolution of the planet using analytical models based on the octupole expansion of the secular Hamiltonian. We also include tidal effects, stellar oblateness and post-Newtonian perturbations. The present work aims at the comparison of the two mechanisms (Lidov–Kozai and planet–planet scattering) as an explanation for the excited and inclined HJs in binary systems. We compare the results obtained through this paper with results in Beaugé & Nesvorný (2012), where the authors analyse how the planet–planet scattering mechanisms works in order to form this hot Jovian-size planets. We find that several of the orbital characteristics of the simulated HJs are caused by tidal trapping from quasi-parabolic orbits, independent of the driving mechanism (planet–planet scattering or Lidov–Kozai migration). These include both the 3-day pile-up and the distribution in the eccentricity versus semimajor axis plane. However, the distribution of the inclinations shows significant differences. While Lidov–Kozai trapping favours a more random distribution (or even a preference for near polar orbits), planet–planet scattering shows a large portion of bodies nearly aligned with the equator of the central star. This is more consistent with the distribution of known hot planets, perhaps indicating that scattering may be a more efficient mechanism for producing these bodies.