Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:09:33+00:00 2026-06-07T21:09:33+00:00

I need a modified Javascript which inflated the pageviews, unique visitors and visitor count!

  • 0

I need a modified Javascript which inflated the pageviews, unique visitors and visitor count!

For educational purposes because I want to see if there are certain patterns when artificaly altering the G. Analytics report

I coded this but it does not work:

 <script type="text/javascript">

var i=0;
 for (i=0;i<=10;i++) {

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-19629541-9']);
 _gaq.push(['_trackPageview']);

   _gaq.push([_setDomainName, '.domain.com']); 
   _gaq.push([_setDomainName, 'domain.com']);

  (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>​​​​

and this Code only alters the pageviews:

<script>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js'     type='text/javascript'%3E%3C/script%3E"));
</script>   
<script>
// Google Analytics
var pageTracker;
try {
    pageTracker = _gat._getTracker("UA-15064357-1"); // pour dystroy.org
    pageTracker._setDomainName("none");
    pageTracker._setAllowLinker(true);
    for (var i=10; i-->0;) pageTracker._trackPageview();
} catch(err) {console.log(err);}
</script>​

I am asking becasue I recenlty viewed an analytics report which did not quite mach up with all the underlaying data

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:09:34+00:00Added an answer on June 7, 2026 at 9:09 pm

    There’s no garanteee that breaking the GA code in a specific way will produce the same results as another GA broken code.

    If you’re trying to understand a specific trend that might have been caused by a broken GA code then you should maybe post the trend and your findings so far to Pro Webmasters and see if they can pinpoint the specific issue.

    Just a spoiler to whoever might be looking at it.

    ATTENTION don’t do this on your site. This is a GA broken code.

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-19629541-5']);
    _gaq.push(['_setAllowHash', false]);
    _gaq.push(['b._setAccount', 'UA-19629541-5']);
    _gaq.push(['b._setAllowHash', true]);
    
    for (var i=0;i<=10;i++) {
      _gaq.push(['_trackPageview']);
      _gaq.push(['b._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);
      })();
    

    UPDATE

    Some explanation of what I’m doing here.

    I’m creating 2 trackers and I haven’t touched the _setDomainName property. It means that both trackers are using the same cookies. But one of the trackers use _setAllowHash true and the other false. _setAllowHash is deprecated these days so you don’t really need it. But what it does is that when false it disables the domain hash, that’s the number you see in cookie _utma before the first dot. When the domain hash is disabled this number is just 1.

    When the first tracker runs it disables the domain hash and creates the cookie, then it fires a pageview. When the second one runs it sees the hash doesn’t match what it was expecting, so it creates a new cookie, overwriting the old cookie.

    They keep running one after the other, removing and recreating the __utma cookie. Turns out that this cookie also holds the visitorId, so that pageview is seen by Google Analytics as a new visitor with a brand new visit.

    This is, unfortunately, fairly common to see around, and thankfully _setAllowHash is deprecated, so there’s no good reason to use it at all. So it shouldn’t happen a often as before, but there are still some settings that can cause problems like this.

    The rule of thumb is if you use multiple trackers always use the same settings with all of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a modified JavaScript which inflated the pageviews, unique visitors and visitor count!
In C++, if you need to have 2 objects modified, you can pass by
if a style is used, it can not be modified agaign. so i need
I need a rewrite in how the modifier 'truncate' is called, because it is
Hi I need to generate a random number in JavaScript between 15 and 225
Hi I am using some modified code from another post. Basically I want to
I'm here now because of two things. First: I need to modify a jQuery
I need to build a small JavaScript library that would only be a couple
I am developing an application which uses .js files stored in the Resources/javascript folder
I need the client (using javascript) to invalidate a page it has and essentially

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.