Jump to content

Google Analytics Conversion - Only picks up around half my orders


Recommended 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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

×
×
  • Create New...