Parker Software Ltd Homepage
Forum Home Forum Home > WhosOn Visitor Tracking & Live Chat > FAQ's > Advanced FAQ's
  New Posts New Posts RSS Feed: Asynchronous Tracking Code
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Asynchronous Tracking Code

 Post Reply Post Reply
Author
Message
James Horton View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 01 Jun 2009
Location: Stoke-on-Trent
Posts: 277
Post Options Post Options   Quote James Horton Quote  Post ReplyReply Direct Link To This Post Topic: Asynchronous Tracking Code
    Posted: 06 Dec 2011 at 11:03am
The following code is fully asynchronous and doesn't require jQuery, however it is very complex. This is so that the load of your page is not dependent on the load of your WhosOn server, say for instance if there is a service interruption or you maintenance is being performed on the service, this does not affect your site load. 

It should go into the Head of the HTML document for your pages.

Make sure to replace the gateway.whoson.com value and the www.domain.com from the example below to suit your own gateway and domain.

<script type='text/javascript' lang='javascript'>
        var sWO={};
                sWO.i =  function()  {if (typeof(woAfterLoad) == 'function') {woAfterLoad(); woAfterLoad = null;}}
        sWO.o = function() { if (typeof(sWOInvite)=='undefined'||sWOInvite=='') {return;} sWOInvite='';sWOTrackPage(); 
            var iog = document.createElement('script');
            iog.type = 'text/javascript';
            iog.async = true;
            iog.onload = sWO.i;
                    iog.onreadystatechange = function () {
                                 if (this.readyState == 'loaded' || this.readyState == 'complete') sWO.i();
                                };
            iog.src='http://gateway.whoson.com/invite.js?domain=www.domain.com'
            var s = document.getElementsByTagName('body')[0]; 
            s.appendChild(iog, s); 
            }
        sWO.f = function() { var wog = document.createElement('script'); 
            wog.type = 'text/javascript'; 
            wog.async = true;
            wog.onload = sWO.o;
            wog.onreadystatechange = function () { if (this.readyState == 'loaded' || this.readyState == 'complete') sWO.o(); };
            wog.src = 'http://gateway.whoson.com/include.js?domain=www.domain.com'
            var s = document.getElementsByTagName('script')[0]; 
            s.parentNode.insertBefore(wog, s);
            };
        if (window.attachEvent) {window.attachEvent('onload', sWO.f);} else {window.addEventListener('load',sWO.f,false)}
</script>


You will need to add a HTML tag to Body. Otherwise the script will not work correctly. This will display the click to chat within the Body of your page and that can be done with the following:

<a id='whoson_chat_link'></a>



Edited by James Horton - 20 Apr 2012 at 9:43am
Best Regards,

James Horton
Technical Analyst
Parker Software
Back to Top
Joe Bragg View Drop Down
New User
New User


Joined: 23 Mar 2012
Posts: 2
Post Options Post Options   Quote Joe Bragg Quote  Post ReplyReply Direct Link To This Post Posted: 23 Mar 2012 at 3:42pm
Hi James

Thanks for this useful post. Unable to see the function woAfterLoad in out hosted scripts at http://whoson.buyitdirect.co.uk:8080/include.js?domain=www.appliancesdirect.co.uk. Is there something in our settings that needs to be enabled to make this function appear in include.js?

Kind Regards

Joe
Back to Top
James Horton View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 01 Jun 2009
Location: Stoke-on-Trent
Posts: 277
Post Options Post Options   Quote James Horton Quote  Post ReplyReply Direct Link To This Post Posted: 26 Mar 2012 at 2:31pm
Hi Joe,

It actually exists within the Invite.js script and not the Include.js script. If you replace the Include.js with Invite.js you should be able to see this via a text search within the document. It is compressed though, so you may not be able to fully read the document at a glance.
Best Regards,

James Horton
Technical Analyst
Parker Software
Back to Top
Joe Bragg View Drop Down
New User
New User


Joined: 23 Mar 2012
Posts: 2
Post Options Post Options   Quote Joe Bragg Quote  Post ReplyReply Direct Link To This Post Posted: 28 Mar 2012 at 2:43pm
works beautifully...thanks James
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.125 seconds.
These are the forums for Parker Software, developers of Live Chat Software: WhosOn and Email Automation Software: Email2DB.