Google Analytics by Yoast
Code for image traffic in custom code box (1 post)

  1. Click-Factor
    Posted 2 years ago #

    Hello I'm trying to add the following code I found for separating traffic from image search.

    [ Moderator note: please wrap code snippets in the backtick character or use the code button. Not the blockquote. ]

    var ref = document.referrer;
    if (ref.search(/google\.([^\/]+)\/(ima?g|.*[?&]tbm=isch|.*[?&]site=images)/i) != -1) {
      var regex = /google\.([^\/]+)\/.*/i;
      var match = regex.exec(ref);
      if (ref.search(/[?&]prev=/i) != -1) {
        regex = /[?&]prev=([^&]*)/i;
        var match2 = regex.exec(ref);
        _gaq.push(['_setReferrerOverride', 'http://images.googleSerps.'+match[1]+unescape(match2[1])]);
      } else {
        _gaq.push(['_setReferrerOverride', 'http://images.'+match[0]]);

    Unfortunately, after updating I get a "Nothing found" page.
    Can someone hint what's wrong with this?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Analytics by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic