Last active
August 29, 2015 14:02
-
-
Save javi830810/393be7bb424de55c0c93 to your computer and use it in GitHub Desktop.
Kapx Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Kapx Events | |
//Events that the users could register to: | |
a = [ | |
'user_registered', | |
'quiz_graded', | |
'challenge_exam_graded', | |
'access_to_course', | |
'course_registration', | |
'profile_email_changed', | |
'challenge_exam_pii_submitted', | |
'new_campaign_registration' | |
]; | |
//Event Triggered | |
{ | |
'action': <STRING>, //Event that triggered | |
'url': <STRING>, //Url to get the event data | |
'data': {}, //Additional data to be sent per event | |
'id': <STRING> //Unique Event Id in Kapx | |
} | |
//user_registered | |
{ | |
'user_id': <STRING>, | |
'username': <STRING>, | |
'country': <STRING>, | |
'email': <STRING>, | |
'name': <STRING>, | |
'lastname': <STRING> | |
} | |
//quiz_graded | |
{ | |
'user_id': <STRING>, | |
'email': <STRING>, | |
'quiz_id': <STRING>, | |
'quiz_name': <STRING>, | |
'course_id': <STRING>, | |
'course_name': <STRING> | |
'score': <FLOAT>, | |
'max_score': <FLOAT>, | |
'date_graded': <STRING>, | |
} | |
//challenge_exam_graded | |
{ | |
'user_id': <STRING>, | |
'quiz_id': <STRING>, | |
'email': <STRING>, | |
'quiz_name': <STRING>, | |
'course_id': <STRING>, | |
'course_name': <STRING> | |
'score': <FLOAT>, | |
'max_score': <FLOAT>, | |
'date_graded': <STRING>, | |
'price': <FLOAT>, | |
'discount_code': <FLOAT>, | |
'discount_amount': <FLOAT>, | |
'final_price': <FLOAT>, | |
'payment_date': <STRING> | |
} | |
//access_to_course | |
{ | |
'user_id': <STRING>, | |
'email': <STRING>, | |
'course_id': <STRING>, | |
'course_name': <STRING>, | |
'date': <STRING> | |
} | |
//course_registration | |
{ | |
'user_id': <STRING>, | |
'email': <STRING>, | |
'course_id': <STRING>, | |
'course_name': <STRING>, | |
'date': <STRING> | |
} | |
//profile_email_changed | |
{ | |
'user_id': <STRING>, | |
'old_email': <STRING>, | |
'new_email': <STRING>, | |
'date': <STRING> | |
} | |
//challenge_exam_pii_submitted | |
{ | |
'pii_info': <STRING>, | |
'unique_transaction_id':<STRING>, | |
'kapx_user_id': <STRING>, | |
'module_id': <STRING>, | |
'course_opaque_id': <STRING>, | |
'client_code':<STRING> | |
} | |
//new_campaign_registration | |
//Take into account this event's data might vary | |
//It depends on what information wants to be captured per campaign | |
{ | |
'first_name':<STRING>, | |
'last_name':<STRING>, | |
'user_id':<STRING>, | |
'url':<STRING>, | |
'client_code':<STRING>, | |
'email':<STRING>, | |
'campaign_source':<STRING>, | |
'action':<STRING>, | |
'date':<STRING>, | |
'campaign_name':<STRING>, | |
'id':<STRING> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from handlers.event_dispatcher import EventDispatcher | |
event_dispatcher = EventDispatcher() | |
event_dispatcher.dispatch_event_async( | |
'challenge_exam_graded', | |
student_record.client_code, | |
extra_data={ | |
'user_id': user_id, | |
'unique_transaction_id': student_record.unique_transaction_id, | |
'systudent_id': student_record.external_student_id, | |
'quiz_id': challenge_exam.id, | |
'quiz_name':challenge_exam.id, | |
'course_id': course.session_opaqueID, | |
'course_name': course.title, | |
'price': course.price, | |
'discount_code': course_purchase.discount_code, | |
'discount_amount': course_purchase.discount_amount, | |
'final_price': course_purchase.amount_paid, | |
'payment_date':course_purchase.created, | |
'date_graded': ce_grades['graded_on'], | |
'score': ce_grades['challenge_exam_grade'], | |
'max_score': ce_grades['max_assignment_grade'] | |
} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="{{ kapx_collect_js_url }}"></script> | |
<script type="text/javascript"> | |
KAPx.collect.data.app_id = "{{ kapx_collect_app_key }}"; | |
$(window).on('kapx-collect.loaded', function() { | |
var eventData = { | |
custome_event_property: 'Hello_World' | |
}; | |
KAPx.collect.raiseEvent("some_client_event!", eventData); | |
// Need to clear out performance data after the initial page_load event is fired to avoid sending duplicate meaningless data. | |
KAPx.collect.data.session_data.performance = {}; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alpha1.
Clients will receive an url, to where they need to go get the Event Data.
Alpha2.
Clients will be able to specify whether they want the Data immediately or on Demand.