Generating events through the Webtrends JavaScript tag

WebBrowser instances embedded in a native app can generate Webtrends events by using JavaScript helper methods that interact with the native app to generate and send events, or by using the Webtrends JavaScript tag in the embedded web content to generate and send events. Follow these instructions to use the Webtrends JavaScript tag.

The native app must implement the Webtrends Mobile Library for Windows Phone, the web content must be tagged with the Webtrends JavaScript tag, and you must be familiar with the Windows Phone embedded Web browser.
  1. Append the WT session parameters to the URL of the embedded web content using the provided helper method. These parameters are parsed by the JavaScript plug-in in the embedded content and used to configure its user ID and session configuration.
    var uri = new Uri(@”http://www.yourdomain.com/targetPage.html”);			
    BrowserWindow.Navigate(WTDataCollector.Instance.appendSessionParamsToUrl(uri);
    
  2. Add the webtrends.id_receiver.js plugin to the JavaScript tag configuration on the embedded content.
    window.webtrendsAsyncInit = function () {
    				
    	var dcs = new Webtrends.dcs().init({
    		dcsid: "<your_dcsid>",
    		timezone: "<your_timezone>",
    		plugins: { 
    			id_receiver: { 
    				src: "//s.webtrends.com/js/webtrends.id_receiver.js"
    			}
    		}
    	});
    				
    	dcs.track();
    }
    
  3. Generate events using track and multiTrack as you would on a standard web page tagged with the Webtrends JavaScript tag.