![]() |
[How To?] Adding tracking code to the AdminCP - Where? - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html) +--- Forum: General Support (https://community.mybb.com/forum-176.html) +--- Thread: [How To?] Adding tracking code to the AdminCP - Where? (/thread-191844.html) |
Adding tracking code to the AdminCP - Where? - groovybluedog - 2016-04-16 Hi, I would like to add a Piwk tracking code to the Admin CP for a variety of reasons, such as spotting fraudulent activities, monitoring/assessing new staff, etc etc... However I don't think the Admin CP has templates in the same way the front end does. My question is: where may I add tracking code? There is a javascript code and a noscript image tracking code. Thanks! RE: Adding tracking code to the AdminCP - Where? - .m. - 2016-04-16 its rather unusual requirement ! anyway, look in file ~/admin/inc/class_page.php#L228 make empty line above it and there you can add required codes with echo statements
however please ensure that you add only trusted script codes RE: Adding tracking code to the AdminCP - Where? - groovybluedog - 2016-06-01 Hi, I've just tried this and unfortunately I'm now getting errors within the admincp: Parse error: syntax error, unexpected 'text' (T_STRING), expecting ',' or ';' in /home/[domain]/public_html/web/admin/inc/class_page.php on line 228 The entire file: http://pastie.org/private/lb9d2uxzkrr7grxspuz3q Even Notepad++'s syntax highlighting doesn't like the tracking code I put in where most text under the code is gray; even after making it all one line, it still generates errors. The tracking code is:
Changing "<script type="text/javascript">" to "<script>" also did nothing. I even tried using the image tracking fallback but that didn't work either RE: Adding tracking code to the AdminCP - Where? - .m. - 2016-06-01 please check if below code works
RE: Adding tracking code to the AdminCP - Where? - groovybluedog - 2016-06-04 Hi, Excellent, works perfectly and the syntax highlighting shows the entire script in grey, which is how it should have been. The tracking works great. Thank you so much! Two more things: 1) Would you mind sharing what you did so I can learn please? I've compared my and your code and can't see an obvious difference? 2) In which page and where would I need to put the code to cover the login page? Thanks! RE: Adding tracking code to the AdminCP - Where? - Devilshakerz - 2016-06-04 (2016-06-04, 12:34 AM)groovybluedog Wrote: 1) Would you mind sharing what you did so I can learn please? I've compared my and your code and can't see an obvious difference?Apostrophes (') within the JavaScript code needed to be escaped with a backslash (\'), since they are used to enclose a PHP string (see https://secure.php.net/manual/en/language.types.string.php). Quote:2) In which page and where would I need to put the code to cover the login page?Try before the </body> tag in https://github.com/mybb/mybb/blob/mybb_1807/admin/inc/class_page.php#L496 |