I know that similar questions have been asked regarding google analytics, but in this case, the tracking code is a bit more complex. I want to append the tracking code to each image viewed via prettyPhoto.
In the prettyPhoto init method I define the changepicturecallback to call a function: myCallbaclFunc:
$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({
animation_speed:'normal',
theme:'light_square',
slideshow:3000,
autoplay_slideshow: false,
show_title: true,
overlay_gallery_max: 3000,
changepicturecallback: myCallbackFunc
});
then, myCallbackFunc is defined as:
myCallbackFunc = function() {
//append code to social container div
$('.pp_social').append('<div class="netscope"><script type="text/javascript">var WRP_ID=316817;var WRP_SECTION="COMUNIDADE";var WRP_SUBSECTION="Estudos MensHealth";var WRP_SECTION_GRP="316817 - MensHealth";var WRP_SUBSECTION_GRP= WRP_SECTION;var WRP_CONTENT="Home content";var WRP_CHANNEL;var WRP_ACC;wreport_ok=0;</scr'+'ipt><script type="text/javascript" src="http://www.autohoje.com/inc/netscope2.js"></scr'+'ipt><script type="text/javascript">if(wreport_ok==1){ var w_counter = new wreport_counter(WRP_SECTION, WRP_SUBSECTION, WRP_ID, WRP_ACC, WRP_CHANNEL, WRP_SECTION_GRP, WRP_SUBSECTION_GRP);w_counter.add_content(WRP_CONTENT);w_counter.count();}</scr'+'ipt></div>');
}
But all I get as I inspect the generated code is the emtpy div class="netscope"
Is there other method than "append" I should be using? Should I somehow escape the javascript code?
Thanks in advance.