segment-io-footer.html 1023 Bytes
Newer Older
1 2 3
<%page expression_filter="h"/>
<%! from openedx.core.djangolib.js_utils import js_escaped_string %>

4 5 6 7 8
% if settings.LMS_SEGMENT_KEY:
    <!-- begin segment footer -->
    <script type="text/javascript">
    % if user.is_authenticated():
        $(window).load(function() {
9
            analytics.identify(
10
                "${ user.id | n, js_escaped_string }",
11
                {
12 13
                    email: "${ user.email | n, js_escaped_string }",
                    username: "${ user.username | n, js_escaped_string }"
14 15 16 17 18 19 20 21 22 23
                },
                {
                    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
                    }
                }
            );
24 25 26 27 28
        });
    % endif
    </script>
    <!-- end segment footer -->
% endif