Support » Plugin: Google Analytics for WordPress by MonsterInsights » Code for image traffic in custom code box

  • 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 (\.([^\/]+)\/(ima?g|.*[?&]tbm=isch|.*[?&]site=images)/i) != -1) {
      var regex = /google\.([^\/]+)\/.*/i;
      var match = regex.exec(ref);
      if ([?&]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?

  • The topic ‘Code for image traffic in custom code box’ is closed to new replies.