PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

Google Analytics Conversion - Only picks up around half my orders

6 replies to this topic
#1
mayday

    PrestaShop Apprentice

  • Members
  • PipPip
  • 30 posts
Hi all

I'm having a problem with Google Analytics. It is only recording around half of my conversions (orders).


Anyone else having similar problems?

- Cory
www.outdoorstore.ch

#2
RaphLeMousse

    PrestaShop Newbie

  • Members
  • Pip
  • 5 posts
Hello,

yes i have the same problem... do you use E-Commerce option or only goals ? Or Adwords conversions (it's ot the same)...

I identified the problem, but still did not find any solution...

When you use the analytics module from prestashop, the analytics tracking code is placed in the main
section of the page... that does not allow the tag to execute properly. You can track visits, bounce rate and all of those data's, but not all e-commerce stuffs (as the analytics tag is correctly running until the
tag is loaded.

So the solution would be to extract the analytics tracking from the
of the page to place it just before the </body> tag... but i still did not find how to do it :(. If you have an idea...

Raph.

#3
mayday

    PrestaShop Apprentice

  • Members
  • PipPip
  • 30 posts
Yeah, I think you're right. I can see how that might be the problem.

I looked into seeing if I could move it ... but it's beyond my limited php skill set.

Can any of you pro's out there help us out?

-Cory
www.outdoorstore.ch

#4
RaphLeMousse

    PrestaShop Newbie

  • Members
  • Pip
  • 5 posts
I just got an answer from a french speaking user on the other forum:

Salut,

Pour intégrer le script de google il vous suffit de le mettre dans le footer.tpl.

pensez à l’encadrer avec les balise {literal}


If you don't speak french, here is the translation:

To integrate the google script, just add it in the footer.tpl. Add it between {literal} tags.

I hope it will work for you, i'll try it right now on my website !

Raph.

#5
mayday

    PrestaShop Apprentice

  • Members
  • PipPip
  • 30 posts
Do let me know if you get it too work. Because I opened up footer.tpl, and it still seems to me like it's going to be more complicated than the short response you got in french ...

THX!

#6
RaphLeMousse

    PrestaShop Newbie

  • Members
  • Pip
  • 5 posts
Ok, i'll let you know !

Raph.

#7
MakeOpen

    PrestaShop Apprentice

  • Members
  • PipPip
  • 88 posts
Hey,

I have also the same problem.
Raph, here is the method for call analytics module at really bottom of the page :

1. Create a new entry in the HOOK db table :

INSERT INTO `PREFIX_hook` ( `id_hook` , `name` , `title` , `description` , `position` )
VALUES ( NULL , "stats", "Stats Hook", "", "1" );


2. Prestashop > Modules > Positions
Add the ganalytics module to the new stats hook
(delete the old placed in footer hook)

3. Edit footer.php
in the $smarty->assign
add this line after 'HOOK_FOOTER'...
'HOOK_STATS' => Module::hookExec('stats'),


4. Edit footer.tpl of your theme
Add {$HOOK_STATS} just before </body>

5. Edit ganalytics.php (in modules)
Add
public function hookStats($params)
{
return $this->hookFooter($params);
}

after

    function hookFooter($params)
{
global $step, $protocol_content;

$output = '
[removed]
[removed](unescape("[removed][removed]"));
[removed]
[removed]
try
{
var pageTracker = _gat._getTracker("'.Configuration::get('GANALYTICS_ID').'");
pageTracker._trackPageview();
'.(strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order.php') === 0 ? 'pageTracker._trackPageview("/order/step'.intval($step).'.html");' : '').'
}
catch(err)
{}
[removed]';
return $output;
}


6. Clear tools/smarty/compile folder (not index.php)

Hope this help !