<!-- Pendo -->
<script>
(function(apiKey){
    (function(p,e,n,d,o){var v,w,x,y,z;o=p[d]=p[d]||{};o._q=[];
    v=['initialize','identify','updateOptions','pageLoad','track'];for(w=0,x=v.length;w<x;++w)(function(m){
        o[m]=o[m]||function(){o._q[m===v[0]?'unshift':'push']([m].concat([].slice.call(arguments,0)));};})(v[w]);
        y=e.createElement(n);y.async=!0;y.src='https://content.analytics.arxiv.org/agent/static/'+apiKey+'/pendo.js';
        z=e.getElementsByTagName(n)[0];z.parentNode.insertBefore(y,z);})(window,document,'script','pendo');

        // Call this whenever information about your visitors becomes available
        // Please use Strings, Numbers, or Bools for value types.
        pendo.initialize({
            visitor: {
                {% if session.get("institution") %}
                institution:     '{{ session.get("institution") }}',
                {% endif %}

                {% if session.get("continent") and session.get("continent").get("code") %}
                continent:       '{{ session.get("continent").get("code") }}',
                {% endif %}

                {% if session.get("country") %}
                country:         '{{ session.get("country") }}',
                {% endif %}

                {% if session.get("subnational") %}
                subnational:     '{{ session.get("state") }}',
                {% endif %}

                {% if session.get("city") %}
                city:            '{{ session.get("city") }}',
                {% endif %}

                id:              '{{ session.get("hashed_user_id") if session.get("hashed_user_id") else "VISITOR-UNIQUE-ID" }}'
                // email:        // Recommended if using Pendo Feedback, or NPS Email
                // full_name:    // Recommended if using Pendo Feedback
                // role:         // Optional

                // You can add any additional visitor level key-values here,
                // as long as it's not one of the above reserved names.
            },

            account: {
                {% if session.get("institution") %}
                name:            '{{ session.get("institution") }}',
                {% endif %}

                id:              '{{ session.get("institution_id") if session.get("institution_id") else "ACCOUNT-UNIQUE-ID" }}'

                // name:         // Optional
                // is_paying:    // Recommended if using Pendo Feedback
                // monthly_value:// Recommended if using Pendo Feedback
                // planLevel:    // Optional
                // planPrice:    // Optional
                // creationDate: // Optional

                // You can add any additional account level key-values here,
                // as long as it's not one of the above reserved names.
            }
        });
})('d6494389-b427-4103-7c76-03182ecc8e60');
</script>
