PDA

View Full Version : Statistics Modifications - Statistics by username in Google Analytics


tpearl5
05-02-2012, 10:00 PM
Have you ever wanted to see whose threads get the most traffic? Well, this simple addition can make that happen.

Open SHOWTHREAD

Find

{vb:raw poll}


Add after:

<script type="text/javascript">
_gaq.push(['_setCustomVar', 1, 'Author', '{vb:raw threadinfo.postusername}',1]);
</script>


This is assuming that your Analytics code is in the header of your site

The report will be available in Google Analytics under Custom Variables.

Update 5/21/2012: 1.1 - changed added Google Analytics tag from memberaction_update to SHOWTHREAD so multi-page threads will be tracked. For example, if someone lands on page 3 of a thread, the author will still be tracked in Analytics.

tpearl5
05-10-2012, 01:19 PM
If you are interested in how to do this for CMS articles, please contact me.

Kolbi
05-14-2012, 12:28 PM
Nice job do you have other interesting tracking functions implemented?

tpearl5
05-14-2012, 07:38 PM
Nice job do you have other interesting tracking functions implemented?

yes actually: https://vborg.vbsupport.ru/showthread.php?t=275526

I have some other custom things going on that use some of the same techniques.

CaneInsider
05-21-2012, 02:21 AM
Great Mod! Works great. Thank you

malmazan
02-17-2013, 10:53 AM
Thanks for sharing this.

Since vB does not provide total views for a section, I have used
<vb:if condition="in_array($vbulletin->parentnode, array(5)) OR $vbulletin->nodeid == 5">

type conditions to add a Google custom code for that ("5" would be the id for the section).

vB does not provide the total number of views for each sub-forum, so it would be nice to add a sub-forum setCustomVar for GA also on SHOWTHREAD , but, unfortunately I have not been able to get the title for the sub-forum on the SHOWTHREAD template.

CAG CheechDogg
12-05-2015, 10:41 PM
Is this still working? for some reason it doesn't on my site