Forum Moderators: DixonJones

Message Too Old, No Replies

Analytics Basic Question

Where to put the code?

         

farmboy

4:15 pm on Sep 22, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does the Analytics code need to be on top of a new page you're creating, on the bottom, does it matter?

I seem to recall it was "top", "bottom", or somewhere.


FarmBoy

phranque

10:21 pm on Sep 22, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



when the apparent page rendering speed was an issue it was better to put it at the bottom. however there was a trade off as some visitors that bounced quickly wouldn't be counted. when asynchronous javascript is used the code is typically located at the top.

farmboy

8:10 am on Sep 23, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



when the apparent page rendering speed was an issue it was better to put it at the bottom. however there was a trade off as some visitors that bounced quickly wouldn't be counted. when asynchronous javascript is used the code is typically located at the top.



Thank you!


-FarmBoy

lucy24

3:34 pm on Oct 27, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



there was a trade off as some visitors that bounced quickly wouldn't be counted

Heh. When I first installed piwik, the docs said somewhere that the code should go at page-bottom precisely because you only want to log people who stay longer than a millisecond.

phranque

6:01 am on Oct 28, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you only want to log people who stay longer than a millisecond


that depends on whether measuring quick bounces is noise or useful information in your specific application.

49 Webstreet

5:37 am on Jan 8, 2015 (gmt 0)

10+ Year Member



the placement of google analytic codes matters.In my opinion the google analytic code always placed on the header section.

[edited by: mademetop at 6:34 am (utc) on Jan 8, 2015]

RhinoFish

5:31 pm on Jan 8, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The latest method, one we recommend, is to put the Google Tag Manager (GTM) container in the head, then use GTM to insert the asynch Analytics script (among other scripts).