ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Google Mobile Analytics and ExpressionEngine

May 21, 2012 5:31am

Subscribe [2]
  • #1 / May 21, 2012 5:31am

    Lima Bean

    13 posts

    Hi all

    Has anyone ever tried using google’s analytics for mobile (https://developers.google.com/analytics/devguides/collection/other/mobileWebsites) on an ExpressionEngine based mobile site? I’ve implemented it exactly as in their example but nothing is being picked up by google. I was just wondering if the way EE parses php might not have something to do with it - I’ve noticed that the $GA_ACCOUNT and $GA_PIXEL variables assigned global scope in the script aren’t available in the function in my EE template - I’ve just re-declared them within the function, but that got me thinking.

    Anyway, any help would be appreciated.

    Thanks

  • #2 / May 22, 2012 12:01pm

    ChiefAlchemist

    913 posts

    Hey Lima

    I have not used it but I do have a silly question…have you turned on PHP for the template you’re embedding the GA-M code?

    Mark

  • #3 / May 22, 2012 1:45pm

    Bhashkar Yadav

    727 posts

    Hi Lima,

    if you are trying to put google’s analytics code into EE template, they will not work. So, it will be best way to develop a plugin for it which will return google’s analytics image URL. And just place the custom plugin tag into your template/page where you want.


    Hope this would help you.


    Best Regards,

  • #4 / May 22, 2012 6:05pm

    ChiefAlchemist

    913 posts

    It won’t work? Why is that? There’s got to a better why than having to write a plug-in.

  • #5 / May 22, 2012 11:07pm

    Bhashkar Yadav

    727 posts

    Hi ChiefAlchemist,

    Did you look into PHP code provided here https://developers.google.com/analytics/devguides/collection/other/mobileWebsites.

    I suggested for plugin because it will be the better way rather than having that code into EE template.


    Best Regards,

  • #6 / May 29, 2012 7:55am

    Lima Bean

    13 posts

    Thanks for your replies. I agree that building it into a module and keeping php out of templates would be better - but is there any reason why it wouldn’t work in a template? As far as I can tell it is generating the correct url for the ga.php file.

  • #7 / May 29, 2012 2:24pm

    Bhashkar Yadav

    727 posts

    Hi Lima,

    I am not much sure about it. I think, putting these code into EE template wouldn’t create image url into img src. But i didn’t tried but putting into EE template. I tried by using PHP files and it worked well.

    Can you please check the image src URL and open it in a new browser window if it’s outputting image of 1x1.


    Best Regards,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases