1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Google Analytics in External Java File

Discussion in 'Google Analytics' started by emil2k, Jul 18, 2006.

  1. #1
    Can someone tell me how I can put Google Analytics tracking code in an external java file?

    Emil
     
    emil2k, Jul 18, 2006 IP
  2. nikao

    nikao Peon

    Messages:
    216
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what exactly do you mean or is your problem?

    All there is to it is make a call to the urchintracker function with some variables set ;)
     
    nikao, Jul 18, 2006 IP
  3. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #3
    you must mean an external javascript file, right?
     
    frankcow, Jul 18, 2006 IP
  4. emil2k

    emil2k Well-Known Member

    Messages:
    1,391
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    138
    #4
    yeah exactly like i need to have all the code they provide in one javascript file called, stats.js, because I call this file from a lot of my pages on the site and it used to have statcounter code but now I would like to have analytics code but I can only fit in this java file as it would be a lot harder to go through and change all the files.

    Emil
     
    emil2k, Jul 18, 2006 IP
  5. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #5
    they do provide it in an external javascript file, you just call it with a couple lines
     
    frankcow, Jul 19, 2006 IP
  6. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #6
    What you could do is add in your javascript file.

    
    document.write("<script language='JavaScript' src='url to javascript file' type='text/javascript'></script>");
    
    Code (markup):
    I'm not completely sure that would work but that would be your best bet.
     
    giraph, Jul 19, 2006 IP