Search

Searching DEVELOPERS

Export Page

Tracking Amplience events as page view allows you to represent Amplience events as virtual URLS.  This is particularly useful if you wish to add Amplience events to your Goals and Funnel Steps.  By using the _trackPageview function in Google Analytics, you can assign a page filename to any Amplience event and enter that filename into the appropriate goal or funnel step. To track a Amplience event, call _trackPageview() with an argument specifying a name for the event.   To map a Amplience module to a specific URL consider using the areaID property on the object as it is a unique identifier for the specific page location for the module.

For example:

<script type="text/javascript">

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', xx-xxxxxx-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>

<script type="text/javascript">

function invokeTenCMSEvent (object){

     var path = '/Amplience/' + object.areaID;

_gaq.push(['_trackPageview', path]);

}

</script>

Important: Please note that your analytics tracking code and calls to _gaq._getTracker must be placed on the page above the call to _trackPageview.

The Amplience event names may be organized into any directory style structure also note that the path/filename argument in _trackPageview  need not represent an actual URL on your website and the argument must begin with a forward slash. 

var path = '/Amplience/' + object.areaID + object.eventName;

To test this 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){

    var path = '/Amplience/' + object.areaID;

              var eventName =  object.eventName ;

              switch(eventName)

              {            

                             //Capture module beging viewed

                             case 'MV':

                                           path += "/MV/event.html";

                                           _gaq.push(['_trackPageview', path]);

                                           break;

                             //Capture Slide display event

                             case "SD":

                                           path += "/SD/event.html";

                                           _gaq.push(['_trackPageview', path]);

                                           break;

                             //Capture the event when link to an external url is selected e.g. going to product details

                             //Could also use _pageview if you want to track as funnel even

                             case "LS":

                                           path += "/LS/event.html";

                                           _gaq.push(['_trackPageview', path]);

                                           alert(object.value + " - " + eventName + " - " + callingElement + " - " + path)

                                           break;  

                             //Capture when an overlay panel is opened incase of product related hotspot a SKU will pass

                             //through as a value     

                             case "PO":

                                           path += "/PO/event.html";

                                           _gaq.push(['_trackPageview', path]);

                                           break;

              }

}

</script>

</body>

</html>