Tracking Comment Activity with Google Analytics
-
I'm digging into the EasyBlog code and trying to find the piece of code that's used to generate the "Submit Your Comment" button for visitors to leave a comment. I'm trying to find the button so that I can wrap the event on click with some tracking code for Google Analytics.
Can some one point me in the right direction for how to add an "onClick=" event to that comment button press event?
Thank you.
Subscribed Products:
9 responses Add a reply
-
Hi Jason,
The button code is @
/components/com_easyblog/themes/default/blog.comment.box.php line 306
The button already has an onClick event attached to it, so you can either:
1. write a custom function to overwrite the original event, as long as your custom function executes the original onClick event
OR
2. Tweak the button's onClick function by editing the function codes in:
/components/com_easyblog/assets/js/eblog-dev.js line 1116
Then replace the file:
/components/com_easyblog/assets/js/eblog.js
with eblog-dev.js in the same folder
If you are having trouble with this, do kindly post the codes you would like to add, along with your site's information, and we'll see if can help you add this in.
-
Subscribed Products: -
-
Subscribed Products: -
Hello Jason,
I am really sorry for the delay of this reply as we are actually pretty occupied with the beta release of EasyBlog 3.5 today. Thanks for getting back to us on this. What you can actually do to avoid any hacking or customizations, is to insert the block of codes below in your template's index.php file. Probably just before the closing body tag,
<script type="text/javascript"> sQuery(document).ready(function(){ var tmp = eblog.comment.save; eblog.comment.save = function(){ _gaq.push(['_trackEvent', 'blog', 'comment',,, false]); tmp(); } }) </script>
-
Okay, I'll give that a try. When you refer to the blog template, are you referring to the main Joomla template or the EasyBlog template?
I'd love to jump on the new beta release, but don't want to introduce any changes to the site just yet. Can't wait for the bugs to be worked out and new features to become available.
Subscribed Products: -
-
Subscribed Products: -
Your Response
Please login to reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.