A jQuery plugin that helps track in one Google Analytics profile links across multiple domains.
JavaScript
Pull request Compare This branch is 7 commits ahead, 1 commit behind lunametrics:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
jquery.xdomain.js

README.md

Cross-domain Google Analytics

The plug-in lets you automatically track links between different related domains using the same Google Analytics profile.

To help properly track links between different domains and subdomains, Google provides a guide on their Analytics page. As it gets tedious very quickly to set it up by hand, this plug-in helps automate the process and track all links for specified domain names.

This plug-in is a fork of xdomain wrapped in a jQuery plugin, with many a modification.

Usage

// Track all links inside #content
$('#content').ga_xdomain({
    // Add GA tracking to links for these domains
    domains:[ 'blog.mysite.com', 'store.mysite.com' ],

    // Include tracking of downloads for these filetypes
    file_types: [ '.xls', '.exe' ]
});

Credits

Original blog post for the xdomain Javascript snippet:

http://www.lunametrics.com/blog/2011/12/01/automatic-cross-domain-tracking-revisited/