PageSourceSearch

http://www.lluisribas.net/sites/all/modules/google_analytics/googleanalytics.js

js lluisribas.net collected 2026-10-02 13:42:41 UTC 2,483 bytes, 67 lines download raw bytes

1// $Id: googleanalytics.js,v 1.1.2.10 2009/03/15 20:32:21 hass Exp $
2
3Drupal.gaTrackerAttach = function(context) {
4  context = context || document;
5
6  $('a', context).click( function() {
7    var ga = Drupal.settings.googleanalytics;
8    // Expression to check for absolute internal links.
9    var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
10    // Expression to check for special links like gotwo.module /go/* links.
11    var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
12    // Expression to check for download links.
13    var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
14
15    try {
16      // Is the clicked URL internal?
17      if (isInternal.test(this.href)) {
18        // Is download tracking activated and the file extension configured for download tracking?
19        if (ga.trackDownload && isDownload.test(this.href)) {
20          if (ga.LegacyVersion) {
21            urchinTracker(this.href.replace(isInternal, ''));
22          }
23          else {
24            // Download link clicked.
25            var extension = isDownload.exec(this.href);
26            pageTracker._trackEvent("Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, ''));
27          }
28        }
29        else if (isInternalSpecial.test(this.href)) {
30          // Keep the internal URL for Google Analytics website overlay intact.
31          if (ga.LegacyVersion) {
32            urchinTracker(this.href.replace(isInternal, ''));
33          }
34          else {
35            pageTracker._trackPageview(this.href.replace(isInternal, ''));
36          }
37        }
38      }
39      else {
40        if (ga.trackMailto && $(this).is("a[@href^=mailto:]")) {
41          // Mailto link clicked.
42          if (ga.LegacyVersion) {
43            urchinTracker('/mailto/' + this.href.substring(7));
44          }
45          else {
46            pageTracker._trackEvent("Mails", "Click", this.href.substring(7));
47          }
48        }
49        else if (ga.trackOutgoing) {
50          // External link clicked. Clean and track the URL.
51          if (ga.LegacyVersion) {
52            urchinTracker('/outgoing/' + this.href.replace(/^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\//i, '').split('/').join('--'));
53          }
54          else {
55            pageTracker._trackEvent("Outgoing links", "Click", this.href);
56          }
57        }
58      }
59    } catch(err) {}
60  });
61};
62
63if (Drupal.jsEnabled) {
64  $(document).ready(function() {
65    Drupal.gaTrackerAttach(this);
66  });
67}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.