I have moved to a new domain

Hello reader, if you are following this blog it might be visible that this blog became stagnant with very less updates. I have moved on to a new domain and a better blogging platform. You can visit it by clicking here. I am trying to update my old posts with the latest developments. Have a great time reading my new blog.

Thursday, January 15, 2015

How to Implement SiteCatalyst on Server side using PHP?

This is an adhoc post I am writing on SiteCatalyst implementation, I will write a detailed series on SiteCatalyst implementation soon. Most of the Web Analytics implementation that's been done on the web is using JavaScript but there might be situations where you will not have that luxury to implement an Analytics tool using JavaScript instead you need to use a Server side approach to do that.

implement-site-catalyst-server-side




So, what is the difference between a client side and server side approach in implementation?


Client side approach is where the Analytics tool library will load on the web browser of the user viewing the website from the JavaScript library. Once the library is loaded on the browser it does series of actions, constructs an image pixel which contains all the required data that needs to be sent to the Analytics server. Finally the pixel will be sent using a HTTP request.

Server side approach is where the Analytics library will be loaded on the server side. All the data related to the user is passed using the Server side language's Global variables and the image request is constructed by the Analytics library. Once the image request is constructed it can be sent to the Analytics Server in two ways. One from the server side without the user's notice. In this method your HTTP Packet sniffers will not be able to pick up all these image requests. Second method is to send it from the client browser. In this method your HTTP Packet sniffers can read the image pixel.

How do you implement SiteCatalyst on Server side (PHP being your language for development) ?


Step 1:

Login to your SiteCatalyst console. Click on the Pancake menu on the top left which opens up your navigation menu. You should see an item called "Admin Tools". Clicking on that should open one more child menu. Click on "Code Manager".

Step 2:

On the right hand side you should see different libraries of SiteCatalyst for different platforms. We are interested in PHP library. Go ahead and click on PHP. A zip file will be downloaded. Extract the contents of the file and copy the "AppMeasurement.php" to your server root directory or the convenient directory of your choice.

Step 3:

Go to the source code of the page you want to implement SiteCatalyst on. Or if you have a common file which can be included in all the pages of your website choose that file and open it in your favorite Text editor.

Step 4:

First step is to load the Library we have just downloaded which can be done using simple require_once command of PHP as below

require_once('AppMeasurement.php');

This basically loads the AppMeasurement Class into your file.

Step 5:

Now that you have referenced the class, your next step is to instantiate a local object using AppMeasurement class which can be done as below.

$s = new AppMeasurement();

Step 6:

Next step is to configure your s object which is your $s variable so that proper data is collected. Let's say we are tracking pagename, a prop and an eVar collecting the Site section of the present page. This is done as shown below

$s->pageName = "Test Home Page";
$s->prop1 = "Home Section";
$s->eVar1 = "Home Section";

You can configure whatever variables you want to like channel, server, events, hierarchy and other standard variables.

Step 7:

Now that you have collected all your data into the local $s object, it's time to tell the $s object where the data needs to be sent. This is called your Tracking Server, you can get this information from your client care. This will look like "yourcompanyname.112.2o7.net" or if you have implemented first party cookies "metrics.yourcompanyname.com". You need to pass this information as shown below.

$s->trackingServer = "yourcompanyname.112.2o7.net";

Step 8:

There are some more important configuration steps you need to do before you send an image request. You can specify the image request dimensions as below.

$s->imageDimensions = "5x5";

I have specified 5x5 above because the most probable case where you might want to implement Sitecatalyst on server side is keeping in mind about the mobile devices. SiteCatalyst prescribes the image request should be of 5x5 if it is from a mobile device.

Also, you need to specify whether you want to send the data from server side or from the client browser. You can do that using the below line.

$s->sendFromServer = true;

If you set the above variable to false, you can see an image request on your browser's packet sniffer. Since I have set it to true, in this case I can set one more variable which might be useful to debug the tracking. I would suggest you keep it as false in your code for convenience.

$s->debugTracking = true;

Step 9:

Once you have performed all the above steps, you can make the image request using the below line of code.

$s->track();

If you are familiar with JavaScript implementation, this above line does the same thing as your s.t() call.

On the whole your page code looks like this

require_once('AppMeasurement.php');
$s = new AppMeasurement();
$s->pageName = "Test Home Page";
$s->prop1 = "Home Section";
$s->eVar1 = "Home Section";
$s->trackingServer = "yourcompanyname.112.2o7.net";
$s->imageDimensions = "5x5";
$s->sendFromServer = false;
$s->debugTracking = false;
$s->track();
I hope you understood the process. Do feel free to post your questions in the comments section.

28 comments :

  1. The expansion of internet and intelligence in business process lead the way to huge volume of data. It is important to maintain and process these data to be efficient in data handling. Hadoop Training in Chennai | Big Data Training in Chennai

    ReplyDelete
  2. Hi, JAVA is not at all difficult all you need is to clear your concepts mainly because the concepts of JAVA programming have been taken from day to day life examples.J2EE Training in Chennai | JAVA Training in Chennai

    ReplyDelete
  3. Hi Admin,
    Thanks for the guide to implement sitecatalyst on server
    Regards,
    DOT NET Training in Chennai|DOT NET Course in Chennai

    ReplyDelete
  4. I went through your blog and it’s totally awesome. Keep on updating your site with such informative post. If possible please include rss feed for your blog. Web design training in Chennai | Web designing course in Chennai | Best web designing course in Chennai

    ReplyDelete
  5. These all are notable facts… I stick with responsive website design for my business. With the mobile marketing is at its peak stage, having website that goes comfy on all devices will help your business. You can check my website for more details on the importance of responsive website design. PHP Training in Chennai | Best PHP training in Chennai | PHP Training Institute in Chennai

    ReplyDelete
  6. Hi Admin, I went through your article and it’s totally awesome. You can consider including RSS feed for easy content sharing, So that you can drive huge traffic to your blog. Hadoop Training in Chennai | Big Data Training in Chennai

    ReplyDelete
  7. Informative article on responsive website design!!! With the expansion of mobile phones, most of us access internet from our mobile and other portable gadgets. Having responsive website for your business will help you to target customers widely. web designing course | Web designing course in Chennai | website design in Chennai

    ReplyDelete
  8. Great and impressive article!! Got to learn and know more about web development. To know more refer create website for much more unique ideas.PHP Training in Chennai | Best PHP training in Chennai

    ReplyDelete
  9. Thanks for your informative blog!!! Your article helped me to understand the installation process of .net programming language. Keep on updating your with such awesome information. best DOT NET Training in Chennai | .net course in Chennai

    ReplyDelete
  10. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information&its very useful to me...
    Android training in chennai
    Ios training in chennai

    ReplyDelete
  11. In these, an article using now web analytics learning beginner very useful. Web site mostly developed my PHP code.The PHP code web analytics implement by severing to client database and then the web creative to PHP Basic to advanced.Here, update for a useful message. If you want to be learning from Big Data Hadoop training reached and visit there for below web page.
    Hadoop Training in Chennai
    Hadoop Training

    ReplyDelete
  12. Excellent blog, I wish to share your post with my folks circle. It’s really helped me a lot, so keep sharing post like this..CCNP Training Institute in Chennai | CCNP Training Institute in Velachery

    ReplyDelete
  13. i had enjoyed the videos and they definitely helped him to understand what it was that he was typing in. He loves everything to do with Scotland so the accent was a bonus!http://www.programmingassignment.net/best-programming-tools/

    ReplyDelete
  14. Wow, informative post within your question and answer sessions of sharing as the step by step process which is really impressive and very easy to understood thing. Thank you so much. best logo design company | online shopping in coimbatore

    ReplyDelete
  15. Your blog was explain everything in detailed manner and it was very interesting to read. Thank you for sharing such a excellent blog., MCSE Training Institute in Chennai | MCSA Training Institute in Chennai | Hardware & Networking Training in Chennai

    ReplyDelete
  16. Nice blog with smart content. The explanation of linux concept was so informative..Thanks for sharing such a nice blogLinux Training Institute in Chennai | Linux Training Institute in Velachery

    ReplyDelete
  17. Thanks for sharing this collective important interview question to our vision, its too useful for my interview preparation... keep posting
    Web Designing Training Institute in Chennai | DotNet Training Institute in Chennai | Java Training Institute in Chennai

    ReplyDelete
  18. Thanks for sharing informative article… Know about How to Change BSNL WiFi Password from techfizy.

    ReplyDelete
  19. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Java Training Institute in Chennai | DotNet Training Institute in Chennai | Web Designing Training Institute in Chennai

    ReplyDelete
  20. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. 
    No.1 Software Testing Training Institute in Chennai | Best Selenium Training Institute in Chennai | ISTQB Certification Center in Velachery

    ReplyDelete