Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › About tracking issues
- This topic has 20 replies, 3 voices, and was last updated 7 years ago by H.K. Latiyan.
-
AuthorPosts
-
June 29, 2016 at 2:15 pm #55623EricSpectatorI am using google analytics to track the activity. when starting a course, all course on page"course status", so I couldn't track how many units they visited. Any better way to solve it? ThanksJuly 1, 2016 at 12:28 pm #55999H.K. LatiyanParticipantPlease try adding this code in your wplms-customizer.php file present in your wplms customizer plugin: add_action('wplms_before_every_unit','track_ajax_unit_views'); function track_ajax_unit_views($id){ ?> <script> // Function to track a virtual page view ga('set', { title: '<?php echo get_the_title($id);?>' }); ga('send', 'pageview'); </script> <?php } NOTE: I have not tested this code but it should do the job.July 1, 2016 at 2:52 pm #56053EricSpectatorHi I just try it and looks not working. Can you help me try if it works on your side. Regards EricJuly 2, 2016 at 1:25 pm #56224MrVibeKeymastercode updated, please try again.July 2, 2016 at 1:34 pm #56226EricSpectatorHi there, where is the updated code?July 4, 2016 at 6:13 am #56341H.K. LatiyanParticipantThe code that I shared is the updated code, Mr. Vibe updated my code/reply. So again use the code in my previous reply and let us know if this helps.July 4, 2016 at 9:02 am #56385EricSpectatorHi, I tried and looks no working. still only show page title "course status"July 6, 2016 at 2:00 pm #56837H.K. LatiyanParticipantThe reason it may not be tracking is because the function "ga" is not defined when the unit is loaded. The trick is to load part of the Google analytics code in header and part of the google analytics code in the footer. In your google anaylytics code which looks like below code: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> break this up into two parts : Part 1 : To be loaded in Header <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); </script> Part II : To be loaded in footer <script> (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> To implement part 1 : add code as shown below: add_action('wp_head','add_ga_code_in_header'); function add_ga_code_in_header(){ ?> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); </script> <?php } To implement part 2: you just need to add the code in WP Admin - WPLMS - Footer - GA section Once you've done this apply the code shared in the previous reply and let us know if it still does not work.July 6, 2016 at 5:32 pm #56867EricSpectatorI tired as your guide, looks still not working. Is it working on your end?July 7, 2016 at 12:44 pm #56991H.K. LatiyanParticipantNo I have not tested it because this can only be tested on the live site so I cannot test it on my test setup (localhost). The method described above is the best way to do this, if its not working then we'll need some time. So please give us some time to check this on our live site. Thanks for patience.July 13, 2016 at 9:30 am #58124EricSpectatorthanks. looking forward to your update then.November 12, 2016 at 6:45 am #79355EricSpectatorHi there, few months past, just check any way can track it now? thanks EricNovember 12, 2016 at 11:47 am #79424H.K. LatiyanParticipantSorry for the late reply. Can you please share the details what things you want to track and also share the help link of the tracking code.November 12, 2016 at 1:49 pm #79463EricSpectatorHi, you can check the previous conversation on this post. <span style="color: #4b4d4d; font-family: Lato; font-size: 14px; line-height: 22px;">I am using google analytics to track the activity. when starting a course, all course on page"course status", so I couldn't track how many units they visited.</span><span style="color: #4b4d4d; font-family: Lato; font-size: 14px; line-height: 22px;"> </span>November 16, 2016 at 1:14 pm #80190H.K. LatiyanParticipantbased on your request we will try to create a custom plugin for Google analytics which would track this. In case you have more variables to track, please do let us know.
-
AuthorPosts
- The topic ‘About tracking issues’ is closed to new replies.