// Google Analytics Traking for competition.mbc.net

var _gaq = _gaq || [];

var gaSection='Not Set';

// events - defaults
var  gaCategory="Not Set";
var  gaAction="Not Set";
var  gaLabel="Not Set";

// user data
var  uName="Not Set";
var  uEmail="Not Set";
var  uCountry="Not Set";
var  uGender="Not Set";
var  uAge="Not Set";


function gaTrack() {
_gaq.push(
    ['_setAccount', 'UA-6002705-1'],
    ['_setDomainName', 'paranormalarabia.com'],
    ['_setAllowAnchor', true],
    ['_setCampContentKey', 'description'],
    ['_trackPageview']
);

_gaq.push(['_setVar',gaSection]);

}

function gaTrackPage(pLanguage, pChannel, pSubChannel) {

// pLanguage   : it can be 'ar' , 'en', 'pa', 'ur'
//  pChannel   : 'commercial' , 'mbc1', 'mbc2, 'mbc3','mbc4', 'mbcAction', 'mbcDrama','mbcMax',  'alarabiya'.
//  pSubChannel: program/series name or sponsor name of competiton

gaSection=pLanguage + '-' + pChannel + '-' + pSubChannel;
gaTrack();

}

function gaTrackFormPage(pLanguage, pChannel, pSubChannel, formCategory, formAction) {

// formCategory :  'survey', 'newsletter', 'contactUs' , 'competition' , 'feedback'
//  formAction : 'post', 'submit', 'subscribe', 'join', ...etc

gaSection=pLanguage + '-' + pChannel + '-' + pSubChannel;
gaCategory=gaSection + '-' + formCategory;
gaAction=formAction;
gaTrack();
  }

function gaTrackEvent() {
   _gaq.push(['_trackEvent',  gaCategory , gaAction, gaLabel]);

}


function gaTrackUserData() {
gaLabel=uEmail;

_gaq.push(['_setCustomVar', 1, 'Section', gaSection, 1]);
_gaq.push(['_setCustomVar', 2, 'Age', uAge, 1]);
_gaq.push(['_setCustomVar', 3, 'Country', uCountry, 1]);
_gaq.push(['_setCustomVar', 4, 'Gender', uGender, 1]);
_gaq.push(['_setCustomVar', 5, 'Email', uEmail, 1]);
gaTrackEvent();

}

function gaSetUserDataViaForm(frmName,tEmail,tGender,tAge,tCountry) {
var frm=document.forms[frmName];

if (tEmail != '') {uEmail=frm.elements[tEmail].value };
if (tGender!='') {uGender=frm.elements[tGender].value};
if (tAge!='') {uAge=frm.elements[tAge].value};
if (tCountry!='') {uCountry=frm.elements[tCountry].value};

}


(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);
  })();
