WebTrends with single page website

2.3k views Asked by At

I have a mobile website we are building. It will be a single page website using AngularJS for the MVC parts. We need to plug in WebTrends tracking to it. However since it is a single page that just uses JS to change the UI I am not sure how we tell/trigger WebTrends to know a new page and been rendered and what that new page is.

Anyone know?

2

There are 2 answers

0
Paul J Abernathy On

I am not familiar with AngularJS, but I have used WebTrends a bit. What I have done in the past to capture user behavior is write my own JavaScript code (you can add it to webtrends.js or your own custom JS file) and then add calls to my JS functions in the HTML elements. My code then called dcsMultiTrack() with parameters for whatever information I needed to send to WebTrends.

For example, if you want to know when a user clicks on some buttom, add something like onClick() = myFunction() to the html element. Inside of myFunction(), have some code to determine what the user is doing and whatever else you want to track. Then call dcsMultiTrack(), passing in the parameters you just determined. If I remember correctly, dcsMultiTrack() allows for flexible lengths of parameters, provided they come in pairs of variable / value, like 'WT.ti','My Page','DCSExt.user_id','your name', etc.

0
John Tabernik On

Magnilex is exactly right--client side, you can call dcsMultiTrack() to simulate a page render. I would suggest a few things:

  • Don't put any custom code in WebTrends.js. You will upgrade this file in the future if you update to a newer WebTrends tag version, so it is best to leave this file as is.
  • You may want to eliminate the initial call to WebTrends that would log the first page being presented so you do not get two hits for the first page display. Check the WebTrends report and see if you are getting a double hit for the first page--if so, you may be calling dcsCollect() at the start via the standard WebTrends initialization javascript.
  • dcsMultiTrack() by default does not include anything except the name/value pairs you pass it. If you want extended information (there are meta tags and a bunch of other tags that WebTrends has available but are ignored by dcsMultiTrack()) you may need to call dcsCollect etc yourself to make sure you pass these along.

Good luck!