Skip to content

Commit

Permalink
Merge pull request #5220 from dimagi/track-user-type
Browse files Browse the repository at this point in the history
track 'Select user type' for Case and Form Exports
  • Loading branch information
NoahCarnahan committed Jan 7, 2015
2 parents df537af + 5015d8f commit d7408a8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
15 changes: 13 additions & 2 deletions corehq/apps/reports/templates/reports/filters/filter_users.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
{% if show_user_filter %}
<div id="{{ css_id }}" class="btn-group" data-toggle="buttons-checkbox">
{% for user in toggle_users %}
<button class="btn{% if user.show %} btn-success{% else %} active{% endif %}"
<button class="btn{% if user.show %} btn-success{% else %} active{% endif %} user-type-btn"
data-checkfilter="user-filter-{{ user.type }}"
data-ufilter="{{ user.type }}">
data-ufilter="{{ user.type }}"
id="btn-user-filter-{{ user.type }}">
{{ user.name }}
</button>
{% endfor %}
Expand All @@ -29,4 +30,14 @@
linkButtonGroup("{{ css_id }}");
});
</script>

<script type="text/javascript">
{% for user in toggle_users %}
$("#btn-user-filter-{{ user.type }}").on('applied-click', function(data) {
if(document.getElementById("user-filter-{{ user.type }}").checked ) {
ga_track_event(data.event_category, 'Select "user type"', '{{ user.name }}');
}
});
{% endfor %}
</script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
});

</script>

<script type="text/javascript">
$('.hq-generic-report').on('apply-click', function() {
$('.user-type-btn').trigger({
type: 'applied-click',
event_category: 'Case Exports'
});
});
</script>
{% endblock %}

{% block reportcontent %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@


</script>

<script type="text/javascript">
$('.hq-generic-report').on('apply-click', function() {
$('.user-type-btn').trigger({
type: 'applied-click',
event_category: 'Form Exports'
});
});
</script>
{% endblock %}

{% block reportcontent %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
trigger: 'hover'
});
</script>

<script>
$('#apply-btn').on('click', function() {
$('.hq-generic-report').trigger('apply-click');
});
</script>
{% endblock %}
{% endblock %}

Expand Down Expand Up @@ -100,7 +106,8 @@
{% block report_filter_actions %}
<button type="submit" class="btn disabled"
data-loading-text="{% trans "Generating Report..." %}"
data-standard-text="{% trans "Apply" %}">
data-standard-text="{% trans "Apply" %}"
id="apply-btn">
{% trans "Apply" %}
</button>
{% endblock %}
Expand Down

0 comments on commit d7408a8

Please sign in to comment.