1

This is very odd to me. I am using this in my templates.

{% extends "_layoutGist.html" %}

My layout is showing up in my Google Analytics. GA is showing showing traffic to

/craft/templates/_layoutGist.html

This seams very peculiar as I would think the file would be fully rendered before Google got ahold of it. Is my tracking code in the wrong place?

enter image description here

  • Any chance you can send a link? – Clive Portman Jan 7 '15 at 12:24
  • Actually, now that I look at it all of my includes are showing up in Google Analytics. This seems incorrect. Here is a URL to examine if you need one. cranberry.com/news-marketing/about There are several includes in here. One that extends layout.html, one that includes header.html, footer.html and a snippet that pulls in Google Analytics tracking code. – David A McInnis Jan 7 '15 at 19:38
  • Looks right to me. Google should just be using the request URLs. Can you post a screenshot of what GA is showing? – Brandon Kelly Jan 7 '15 at 23:27
  • For GA to track these views either the GA tracking code needs to be fired in the browser from those URLS or you're manually sending page hits using something like this: ga('send', { 'hitType': 'pageview', 'page': '/craft/templates/_layout.html' }); Either that or there's some server-side implementation going on? – Clive Portman Jan 8 '15 at 10:51
  • What happens if you instead place your GA tracking code in your layout template? – Clive Portman Jan 8 '15 at 22:51
3

From my testing it appears that this is an issue with Google's universal analytics.

Based off of Clive's recommendation, my solution what to change

  ga('send', 'page view');

to

  ga('send', 'pageview', {
   'page': '/{{entry.slug}}',
   'title': '{{entry.title}}'
  });

This seems to be holding up well.

2

If your Craft templates folder is above the document root and not public, it couldn't be "real" traffic. Could be residuals left over from testing somehow (like a live preview or test domain or what not.) Not sure I'd worry about it unless they keep increasing?

I did notice you have 2 tracking codes installed... there's one in the head and one in the footer (cranberryburst.com). Could be wrecking havoc?

  • Yes, my craft folder is above my public folder and not accessible from the web. I have removed the second tracking code and will continue to monitor. – David A McInnis Jan 8 '15 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.