Blunt GA
Modify the GA tracking code (4 posts)

  1. stevewatson
    Posted 2 years ago #

    I am trying to update the js tracking code to support Display Advertising which will track demographics. Apparently this only requires a single line of code:

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    Change to:

    ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';

    I have found where this code is written in the plugin and changed the code, but this isn't being reflected on the website source code. It my method even possible? Have I done something wrong?

    Kind regards.


  2. John Huebner
    Plugin Author

    Posted 2 years ago #

    There are 2 issues.

    The first is where you've probably altered the code and the second has to due with validating the code after installation.

    Second issue first, verification with GA.

    We've actually been looking into using this modified version of the GA script. The problem that we run into is that GA wants to verify that you've made the change. It does this by reading in the source of your home page and seeing if the correct code snippet is found. This is where the problem is because this plugin does not actually include the code snippet in the source of your page. Instead the snippet they are looking for is in an external script that they cannot check.

    Unfortunately I haven't come up with a plan yet on how this can be corrected and at this time I'm not even sure I can. In the end it will take a major overhaul of this plugin.

    First issue, where to edit the script.

    I'm going to assume that you edited the file "blunt.ga.install.v3.js" which is the uncompressed version of the script. This file isn't actually used when running on a site. The version that is actually used id the compressed version "blunt.ga.install.v3.min.js".

    You have 2 choices:

    1. You can try to edit the compressed version
    2. You can alter the PHP Script to load the uncompresses version. This is actually easier. On line 14 of the file "blunt.ga.class.php" you will find this line:
      private $minified = true;
      change this value to false and the uncompressed JS file will be loaded.

    Even if you make the modifications you will run into trouble with the second issue.

  3. stevewatson
    Posted 2 years ago #

    I tried changing the minified value to false, but the source code still shows the ga.js code snippet. Not to worry, I can quite easily live without the demographics.

    How are getting on with the items on your "to-do" list and the universal GA code snippet?

    Thanks for responding and keep up the good work.

  4. John Huebner
    Plugin Author

    Posted 2 years ago #

    As far as the to-do list goes, I've been giving that a lot of thought lately. Please read this post I put together about it last night.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Blunt GA
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic