% if settings.LMS_SEGMENT_KEY:
    <!-- begin segment footer -->
    <script type="text/javascript">
    % if user.is_authenticated():
        $(window).load(function() {
            analytics.identify(
                "${user.id}",
                {
                    email: "${user.email}",
                    username: "${user.username}"
                },
                {
                    integrations: {
                        // Disable MailChimp because we don't want to update the user's email
                        // and username in MailChimp on every page load. We only need to capture
                        // this data on registration/activation.
                        MailChimp: false
                    }
                }
            );
        });
    % endif
    </script>
    <!-- end segment footer -->
% endif
