Embed presentation
Downloaded 49 times
















![Simplest GATC Installation
• All content on a single domain
<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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-17-320.jpg)
![GATC – Multiple Sub-Domains
• Content exists on multiple sub-domains on a single top-level domain
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setDomainName', '.mysite.com']);
_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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-18-320.jpg)
![GATC – Multiple Domains
• Content exists on multiple top-level domains
_link()
<script type="text/javascript"> Update all links between domains to include the _link() method.
var _gaq = _gaq || []; <a href=“http://www.mysite-support.com” onclick=“_gaq.push
_gaq.push(['_setAccount', 'UA-XXXXX-X']); ([‘_link’, this.href]);”>Support</a>
_gaq.push(['_setDomainName', ’none']);
_gaq.push(['_setAllowLinker', true]);
_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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-19-320.jpg)
![GATC – Multiple Domains and Sub-Domains
• Content exists on multiple sub-domains on multiple top-level domain
_link()
Update all links between domains to
<script type="text/javascript"> include the _link() method.
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']); Do not change links between sub-
_gaq.push(['_setDomainName', ’.mysite.com']); domains on the same top-level
_gaq.push(['_trackPageview']); domain.
(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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-20-320.jpg)
![Linking
When content exists on multiple domains use linking methods to pass cookie
information between domains:
• For HTTP GET include the _link() method.
_link()
• Cookie info in URL parameters
• Redirects user to the new URL
<a href=“http://www.example.com” onclick= “_gaq.push([‘_link’, this.href]);”>Example</a>
• For HTTP POST include the _linkByPost() method.
• Cookie info in action value
• Used for forms and iFrames on other domains
SUBMIT
<form action="http://www.shoppingcart.com/form.php" name="f" method="post”
onsubmit=”_gaq.push([‘_linkByPost’, this]);">
. . . </form>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-21-320.jpg)



![Enter Event Tracking
• Track events on your site
• Detect events and trigger tracking call
_gaq.push(['_trackEvent', Purpose Example
category, Group of objects being 'Markers'
action, tracked
Type of user interaction 'Click'
opt_label, with the object
opt_value]); Additional info about 'Google
the event Singapore'
Numerical data about 1
the event
2
5](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-25-320.jpg)


















![<!– Email share button: -->
<a onclick="showMailer('Check out MilkADeal for huge
discounts in Malaysia! Here is my referral link: http://
milkadeal.com/r/');return false;" href="#"><div id="lnkMail"></
div></a>
<!– Functions to track email share button usage: -->
<script>
function showMailer(myBody){
_gaTrack();
$(".winMessage").html(myBody);
$("#mailer").modal();
}
function _gaTrack() {
_gaq.push(['_trackSocial', 'email', 'share']);
}
</script>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-44-320.jpg)












![Tracking setup
<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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-57-320.jpg)
![Tracking setup
<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-
XXXXXX']);_gaq.push(['_trackPageview']);_gaq.push(['_trackPageLoadTime']);
(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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-58-320.jpg)










![Track Activity to Mobile Websites [link]
Mobile Websites
ü Server-side tracking
ü Track all web-enabled devices (not just JS & cookie capable)
ü Four languages supported: PHP, Perl, JSP, ASP
ü Works just like Analytics on desktop web pages](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-69-320.jpg)































Google Analytics is a tool for measuring website traffic and usage. It works by tracking user behavior through a tracking code installed on pages. The code collects data on page views, user interactions, and traffic sources which is then compiled into reports. The tracking code works asynchronously to not slow down page loads. It collects data and sends it to Google servers where it is stored and can be accessed through a web-based interface. Event tracking allows user interactions beyond just page views to be measured, providing more insights into user behavior on sites.
















![Simplest GATC Installation
• All content on a single domain
<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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-17-320.jpg)
![GATC – Multiple Sub-Domains
• Content exists on multiple sub-domains on a single top-level domain
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_setDomainName', '.mysite.com']);
_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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-18-320.jpg)
![GATC – Multiple Domains
• Content exists on multiple top-level domains
_link()
<script type="text/javascript"> Update all links between domains to include the _link() method.
var _gaq = _gaq || []; <a href=“http://www.mysite-support.com” onclick=“_gaq.push
_gaq.push(['_setAccount', 'UA-XXXXX-X']); ([‘_link’, this.href]);”>Support</a>
_gaq.push(['_setDomainName', ’none']);
_gaq.push(['_setAllowLinker', true]);
_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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-19-320.jpg)
![GATC – Multiple Domains and Sub-Domains
• Content exists on multiple sub-domains on multiple top-level domain
_link()
Update all links between domains to
<script type="text/javascript"> include the _link() method.
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']); Do not change links between sub-
_gaq.push(['_setDomainName', ’.mysite.com']); domains on the same top-level
_gaq.push(['_trackPageview']); domain.
(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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-20-320.jpg)
![Linking
When content exists on multiple domains use linking methods to pass cookie
information between domains:
• For HTTP GET include the _link() method.
_link()
• Cookie info in URL parameters
• Redirects user to the new URL
<a href=“http://www.example.com” onclick= “_gaq.push([‘_link’, this.href]);”>Example</a>
• For HTTP POST include the _linkByPost() method.
• Cookie info in action value
• Used for forms and iFrames on other domains
SUBMIT
<form action="http://www.shoppingcart.com/form.php" name="f" method="post”
onsubmit=”_gaq.push([‘_linkByPost’, this]);">
. . . </form>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-21-320.jpg)



![Enter Event Tracking
• Track events on your site
• Detect events and trigger tracking call
_gaq.push(['_trackEvent', Purpose Example
category, Group of objects being 'Markers'
action, tracked
Type of user interaction 'Click'
opt_label, with the object
opt_value]); Additional info about 'Google
the event Singapore'
Numerical data about 1
the event
2
5](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-25-320.jpg)


















![<!– Email share button: -->
<a onclick="showMailer('Check out MilkADeal for huge
discounts in Malaysia! Here is my referral link: http://
milkadeal.com/r/');return false;" href="#"><div id="lnkMail"></
div></a>
<!– Functions to track email share button usage: -->
<script>
function showMailer(myBody){
_gaTrack();
$(".winMessage").html(myBody);
$("#mailer").modal();
}
function _gaTrack() {
_gaq.push(['_trackSocial', 'email', 'share']);
}
</script>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-44-320.jpg)












![Tracking setup
<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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-57-320.jpg)
![Tracking setup
<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-
XXXXXX']);_gaq.push(['_trackPageview']);_gaq.push(['_trackPageLoadTime']);
(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>](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-58-320.jpg)










![Track Activity to Mobile Websites [link]
Mobile Websites
ü Server-side tracking
ü Track all web-enabled devices (not just JS & cookie capable)
ü Four languages supported: PHP, Perl, JSP, ASP
ü Works just like Analytics on desktop web pages](https://image.slidesharecdn.com/devfestchiangmai-implemetninggoogleanalytics-2011-09-24-ppt-110924140332-phpapp01/85/implemetning-google-analytics-2011-09-24-Google-Devfest-Chiangmai-69-320.jpg)





























