Course start > create POST api request (email as variable)

Home Forums Legacy Support Support queries How-to & Troubleshooting Course start > create POST api request (email as variable)

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2322
    bonzoren
    Participant
    When someone starts a course, it needs to get 'read and analyze' access to a Google Analytics account. There is a GA API for that which should use the email address of the course taker as a variable. The API code is: POST https://www.googleapis.com/analytics/v3/management/accounts/xxxxx/webproperties/UA-xxxxxxxx-1/profiles/xxxxx/entityUserLinks { "userRef": { "email": "[email protected]" }, "permissions": { "local": [ "READ_AND_ANALYZE" ] } } I read something about the hook wplms_start_course, just don't know how to get started. Any help would be much appreciated.
    #2477
    Anshuman Sahu
    Keymaster
    Please add your custom code in wplms customizer.php file and post the value  like this  :   add_action('wplms_course_start_after_timeline','gacpde',10,1); function gacode($course_id){     $user_id = get_current_user_id();     $user = get_user_by( 'id', $user_id);     $course_status = bp_course_get_user_course_status($user_id,$precourse);     if( $course_status == 1){     ?>     <script>     //send code to GA via js     <?php  echo $user->user_email; //will echo the user email      ?>     </script>     <?php     } } Please post the json object to the url via js  .
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Course start > create POST api request (email as variable)’ is closed to new replies.