Integrate Google Analytics

Integrate Google Analytics

You can track the microsite traffic and other things such as eCommerce transactions, using your Google Analytics account also (besides detailed reporting within the LMS itself). To do this, follow these steps.

1. Disable the default GA tracking of EduBrite - by adding following custom property in  Site admin -> Site Details -> Customization tab

DISABLE_DEFAULT_TRACKING=true

2. Add the custom tracking code in the Site admin -> Site Placements -> V2 FooterJS placement. An example code snippet is shown below.

<!-- GA tracking start -->
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
    _gaq.push(['_setDomainName', 'yoursite.edubrite.com']);
    _gaq.push(['_setAllowLinker', true]);
    _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);
      })();
<!-- tracking ends -->

3. To track the payment transactions (if you are using catalog to sell courses)

Access catalog - settings and enable 'show confirmation page after payment success'.

 

<!-- GA tracking start -->
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
  _gaq.push(['_setDomainName', 'yoursite.edubrite.com']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);
try{
  if(ebTxn_InvoiceId){
    _gaq.push(['_addTrans',
       ebTxn_InvoiceId,    
       ebTxn_Url,
       ebTxn_Amount+"",        
       '',
       '',
       '',
       '',
       ''  
    ]);
    _gaq.push(['_addItem',
       ebTxn_InvoiceId,    
       ebTxn_EntityId,
       ebTxn_EntityName,
       ebTxn_EntityType,  
       ebTxn_Amount+"",         
       '1'
    ]);
    _gaq.push(['_trackTrans']);
  }
}catch(er){}

      (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);
      })();

<!-- tracking ends -->

Variables provided by the system

ebTxn_InvoiceId, ebTxn_Amount, ebTxn_Currency, ebTxn_CouponCode, ebTxn_EntityType, ebTxn_EntityId, ebTxn_EntityName

 


Rating: