Every web application usually requires support for tracking visitors behavior. Most of the solutions can be easily integrated into a website by adding a small javascript snippet into every page you want to track. Below you can find some popular tracking solutions (free or commercial).
At the moment of writting this article, there are plenty of options available for web developers to track their website performance:
- Google analytics (probably the most popular solution).
- Reinvigorate.
- KISSmetrics.
- FoxMetrics.
- Mint.
- Open Web Analytics.
- Clicky.
- Mixpanel.
- Chartbeat.
- Adobe Web Analytics.
- Chartbeat.
- Inspectlet.
Of course there are many other solutions available out there. For more information about the above mentioned solution I recommend you read the excellent article posted by Aidan Huang.
Follow the steps from this section in order to enable tracking in Fantastico projects:
Activate tracking extension:
fsdk activate-extension --name tracking_codes --comp-root <comp_root>
Add your tracking codes into database (easiest way is through Syncdb command)
Create a sql script similar to the one below and place it under <comp_root>/sql/create_data.sql:
INSERT INTO tracking_codes(provider, script)
VALUES ('Google Analytics', '
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-XXXXX-X"]);
_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);
})();
</script>');
Update your project database
fsdk syncdb --db-command /usr/bin/mysql --comp-root <comp_root>
Use tracking codes in your pages:
{% component url="/tracking-codes/ui/codes/" %}{% endcomponent %}
Tracking component is rendering all available codes from the database. In order to check all available tracking codes configured in a Fantastico project visit http://localhost:12000/tracking-codes/ui/codes/. Once the page is loaded see page source.
In the first version of this component (part of Fantastico 0.4) there are some known limitations:
- No API provided for Create / Update / Delete operations.
This class provides the tracking operations supported by TrackingCodes component.
This method provides tracking codes listing logic. It list all available tracking codes from database.
Parameters: | request (webob.request.Request) – The current http request being processed. Read Request lifecycle for more information. |
---|---|
Returns: | JSON list of available tracking codes. Can be empty if no tracking codes are defined. |
This class provides the model for tracking codes. It maps tracking_codes table to an object. In order to use this model please read Model View Controller.