How can I force the Mixpanel cookie to be secure?

By default, Mixpanel cookies can be transmitted over standard http. However, Mixpanel’s JavaScript library provides a configuration to transmit your cookies over https. To do so, use the set_config() method and change the secure_cookie flag from false to true. This means Mixpanel cookies can only be transmitted over https.

Using the set_config() method will look like this:


You can also slightly modify your init function in the JavaScript library to the following: