Jump to content

Google Analytics link tracking


Recommended Posts

Hello,

 

I just started using the Google Analytics module on Prestashop v1.4.8 but it doesn't really work well as it's only tracking links in this format:

/products

/index

/category

/contactform

...

 

instead of something like /5-myproduct.html :mellow:

 

Because of this, so many important features don't work properly (like in-Page analytics etc.)

 

Is there a way to fix this? If not...where could I add the GA code manually?

 

Any help will be highly appreciated... ;)

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

I just started using the Google Analytics module on Prestashop v1.4.8 but it doesn't really work well as it's only tracking links in this format:

/products

/index

/category

/contactform

...

 

instead of something like /5-myproduct.html :mellow:

 

Because of this, so many important features don't work properly (like in-Page analytics etc.)

 

Is there a way to fix this? If not...where could I add the GA code manually?

 

Any help will be highly appreciated... ;)

 

Same problem over here! also trying to find a solution! Let me know if you have found one, i'll do the same!

Link to comment
Share on other sites

@davewalschot

 

 

Yes, I found a solution.

 

Just insert your Google Analytics script at the end of the header.tpl file beween a

 

 

{literal} ...your GA code... {/literal}

 

 

tag. Don't forget to disable the GA module.

Works perfectly for me...

Link to comment
Share on other sites

Mine is hooked in header but still works as walter6 reports; it seems that the direct code inclusion in header.tpl is better.

 

I do agree that including in header works, until you load a new theme then it doesn't work. But IMHO having a compliant theme is better than people having to change files and then know they have to turn off smarty compile.

Link to comment
Share on other sites

Guys,

 

Thanks for joining the discussion! though the issue that i have (and walter6 had) is not that pages are not included in GA but that the the pages that are included (AFAIK all of mine get reported) do not show the right level of detail.

 

To give you one example. All my product show up with the same page name being "/product" (see screenshot) instead of url path to identify the unique product page. post-298392-0-63729700-1346264041_thumb.png

 

Altough that in GA one can also select the field "title" which useally is unique per page, a lot of analysis are based on the "page name" field. Therefore this is not really an option if you want to know the details.

 

I also have another site based on joomla, the GA there does report the full path of the page name. This makes the prestashop ganalytics module implementation suspect ;)

 

I havent tried the option that walter6 posted

Just insert your Google Analytics script at the end of the header.tpl file beween a {literal} ...your GA code... {/literal}
but looking at the ganalytics code i expect to lose information like the conversion stuff
Link to comment
Share on other sites

First, I probably came off a bit strong...my background is don't modify the vanilla code....I had one customer who inserted his analytics into the header.tpl this and could not understand why our multishop module was not giving analyitcs the correct ua-id..for his other domains.

 

But the crux of it that this does not fix the underlying issue, i.e. the module works for the vast majority % of the community...so where is the problem? My assumption is that it is not the module inserting the google analytics code but rather something else.

 

Here is my google analtyics running on 1.4.6.2 and analyitcs module version v1.3. As you can see my pages are reported with all detail.

 

08.29.2012-20.56.06.png

http://screencast.com/t/fUI9WbVBe

Link to comment
Share on other sites

Hi elpatron,

 

havent noticed you "comming off strong" ;)

 

Below a screenshot from 1.4.6.? or 1.4.7, after upgrade though is gone.

post-298392-0-84006700-1346272905_thumb.png

 

looking at the header.tpl the module i think that that is where the events get pushed

_gaq.push(['_setAccount', '{$ganalytics_id}']);
// Recommanded value by Google doc and has to before the trackPageView
_gaq.push(['_setSiteSpeedSampleRate', 5]);

 

I am tempted to change the code (just for the fake of the experiment) as i dont see a parameter passed here that indicates the page. Having a 2 minute view at the google doc (and not being an expert in anything) i find this GA code to send the page

_gaq.push(['_trackPageview', '/home/landingPage']);

copied from https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration#_gat.GA_Tracker_._trackPageview

 

any comments? or anyone knowing the php variable to get the path out of his head?

Link to comment
Share on other sites

I coudn't let it go, checked the code a bit further. a few line below the ganalytic code states

 

{if isset($pageTrack)}_gaq.push(['_trackPageview', '{$pageTrack}']);{/if}

 

Which is actually the code to send the page, BUT the $pageTrack variable is filled with what is seen in Google Analytics. in another variable ($request_uri) the URL (eg /en/accessories-ipod/8-belkin-leather) is stored.

 

Unless this field is somehow changed by some other module (which is very unlikely i think) the prestashop guys decided to change this (i think) somewhere in the past.

 

Guess we need to ask them why, perhaps I am making wrong assumptions here

 

whats the best way of doing that? filing a bug report?

 

btw i checked this against the latest 1.4.9

Link to comment
Share on other sites

  • 2 weeks later...

Update; This change certainly something everyone into analytics should have, After changing (see http://www.prestashop.com/forums/topic/172576-google-analytics-tracking/) we are able to do a much more detailed analysis. The part that is still working 100% is the orders part, hope to have a further look at that soon.

 

I recommend everyone with the default GA prestashop module to use this. I will update this thread once i have made the final changes.

Edited by davewalschot (see edit history)
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...