The main issue was the excessive and unnecessary data fetched with each query, such as images, ratings, and opening hours, which resulted in higher costs. Additionally, the system was designed to make a new API request with every keystroke, further increasing expenses without adding value to the user experience.
To address these issues, we optimized the use of the Google Place Autocomplete API by implementing a sessionToken
method. This approach consolidated multiple autocomplete requests into a single session, significantly reducing the number of calls to the API. We also refined the data fields requested to only those necessary, specifically the location coordinates, avoiding the extra charges for unneeded data.
These changes led to a drastic reduction of 80% in Google Place Autocomplete costs. The optimization not only preserved the functionality needed for effective e-commerce operations but also significantly reduced overheads, contributing directly to improved profitability.