Search

Searching DEVELOPERS

Export Page

Event Tracking is a method available in the Google Analytics tracking code that you can use to record user interaction with Amplience element. When used this way, user activity for Amplience modules is calculated and displayed as Events in the Google Analytics reporting interface. A benefit of using Event Tracking over the pageview method is that pageview calculations are unaffected by tracked user activity. Finally, Google Event Tracking employs an object-oriented model that you can use to collect and classify different types of interaction with Amplience modules and pages.

The specification for the Google _trackEvent() method is:

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)
  • category (required)

The name you supply for the group of objects you want to track.  It may be useful to use the areaID property on the object passed in invokeTenCMSEvent  as it is a unique identifier for the specific page location for the module.

  • action (required)

A string that is used to define the type of Amplience user interaction. Typically the object.eventName is used.

  • label (optional)

An optional string to provide additional dimensions to the event data. This can be used for identifying the calling element (object.parent + “.”+ object.element) or the value associated with the action (object.value) such as SKU for Opened Product Panels and URLs for Selected Links.

  • value (optional)

An integer that you can use to provide numerical data about the user event.

  • non-interaction (optional)

A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation.

To test Google event tracking end to end:

  • Setup a test Google Analytics account for a test server
  • Create a Module and Area using the Amplience portal,
  • Created a simple HTML page with the Google Analytics JavaScript snippet for tracking and the Amplience embed code for the Area/Module
  • Add the invoke JavaScript function for integrating Amplience module events with Google Analytics
  • Publish the Amplience module from the Portal to the test server
  • Open the test page in the browser and click through the Module triggering events
  • View the reports when they are available from Google Analytics reports.

Example HTML:

<html>

<head>

<script type="text/javascript" src="swfobject.min.js"> </script> <script type="text/javascript" src="interact.min.js"> </script>

</head>

<body>

<script type="text/javascript">

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'xx-xxxxx-xx']);

  _gaq.push(['_trackPageview']);

  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

</script>

<div id="tc_Johnw"> <!-- Insert SSI include to the SEO file here --> </div>

<script language="javascript"> interact.embedApp({ target: "tc_Johnw", width: 450, height: 300, vars: {id: "c5d91e41-3390-4ee4-a242-1daef89444f8"}, params: {bgcolor: "#ffffff"}, src: [ {type:"html5", src:"tcplayer.js", xd: ["http://staging.10cms.com/xd.html"]}, {type:"swf", src:"tcplayer.swf",version:"9.0.0"} ] });

function invokeTenCMSEvent (object){

//create string for calling element. 

//It is possible for the calling element to be undefined,

//You should therefore trap this if you decide not to include parent property.

var callingElement = object.parent +"|" + object.element;

//create string for 10CMSEvents

         var eventName =  object.eventName ;

//track all Amplience events under the category 10CMS events

          _gaq.push(['_trackEvent', "10CMS Events", eventName, callingElement]);      

}

</script>

</body>

</html>

In the Google Analytics reporting interface Events can be viewed under the content section.  For the above example the Google Analytics interface will look something like this:

Google-Analyics-Events_action_.jpg