1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PhpMyMovie Script! How do i add my Google Analytics Code?

Discussion in 'HTML & JavaScript' started by cgFuse, Dec 17, 2012.

  1. cgFuse

    cgFuse Newbie

    Joined:
    Apr 18, 2009
    Messages:
    39
    Likes Received:
    2
    I have never had this problem before trying to add my analytics code to any of my other scripts before but for some reason i cant seem to figure out how to add it to this particular script, nothing ive tried is working. If anyone could possibly help it would be greatly appreciated.
     
  2. olystyle

    olystyle Regular Member

    Joined:
    Jan 6, 2012
    Messages:
    238
    Likes Received:
    103
    Hi cgFuse

    Can you specify what files your script is containing? like: main.php, config.php, etc...

    cheers olystyle
     
    • Thanks Thanks x 1
  3. cgFuse

    cgFuse Newbie

    Joined:
    Apr 18, 2009
    Messages:
    39
    Likes Received:
    2
    If i go to themes/default/global some of the files i could use are footer.tpl and header.tpl. I think that is why im having trouble, because its a .tpl file and im not sure what that really is.
     
  4. olystyle

    olystyle Regular Member

    Joined:
    Jan 6, 2012
    Messages:
    238
    Likes Received:
    103
    Do the .tpl files acutally contain php? What kind of files are outside of your theme folder?

    cheers
     
    • Thanks Thanks x 1
  5. cgFuse

    cgFuse Newbie

    Joined:
    Apr 18, 2009
    Messages:
    39
    Likes Received:
    2
    I think it would be easier if i just uploaded the script, so here it is.

    http://www.2shared.com/file/bjgnXR57/PhpMyMovie.html
     
  6. olystyle

    olystyle Regular Member

    Joined:
    Jan 6, 2012
    Messages:
    238
    Likes Received:
    103
    Alright place your analytics snippet in the footer.tpl (/PhpMyMovie/uploads/themes/default/global/footer.tpl)

    Code:
    //at the very bottom you'll find the body and html closing tags
    //Here's where you should place imho the analytics snippet
    
    <script type="text/javascript">
    //just a sample snippet from developers.google.com
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXX-X']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script></body>
    </html>
    
    let me know if its working

    cheers olystyle
     
    • Thanks Thanks x 1
  7. cgFuse

    cgFuse Newbie

    Joined:
    Apr 18, 2009
    Messages:
    39
    Likes Received:
    2
    Google does not pick up the tracking code and the footer dissapeared from the bottom of the page.

    Code:
    </tr></table>
    </div>
     
    <script type="text/javascript">
    
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-35540190-1']);
      _gaq.push(['_trackPageview']);
    
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    
    </script>
    
    
    </body></html>
     
  8. hameem

    hameem Elite Member

    Joined:
    Jul 21, 2011
    Messages:
    1,880
    Likes Received:
    985
    Location:
    221B Baker Street
    why not insert that code in the index.php?
     
    • Thanks Thanks x 1
  9. cgFuse

    cgFuse Newbie

    Joined:
    Apr 18, 2009
    Messages:
    39
    Likes Received:
    2
    It needs to be in a file that loads on every page, not just the index.
     
  10. olystyle

    olystyle Regular Member

    Joined:
    Jan 6, 2012
    Messages:
    238
    Likes Received:
    103
    Just had a look at the index.php - and from the looks of it the footer.tpl should be loaded by the index.php before the footer.php...
    Try to embed the analytics snippet within the footer.php (you can find it in modules/commons/footer.php ) and see if this works..

    cheers
     
    • Thanks Thanks x 1
  11. cgFuse

    cgFuse Newbie

    Joined:
    Apr 18, 2009
    Messages:
    39
    Likes Received:
    2
    Awesome! Your a genious! I was worried something was wrong because it was a blank file but it worked! Thanks alot, i have literally tried everything but that lol.
     
  12. olystyle

    olystyle Regular Member

    Joined:
    Jan 6, 2012
    Messages:
    238
    Likes Received:
    103
    You are welcome :D

    Nice script by the way...

    cheers olystyle
     
    • Thanks Thanks x 1
  13. asylum168

    asylum168 Newbie

    Joined:
    Aug 23, 2013
    Messages:
    5
    Likes Received:
    0
    do u know how to fetch streaming movie links ?
     
  14. rawiswar2001

    rawiswar2001 Registered Member

    Joined:
    Feb 13, 2013
    Messages:
    78
    Likes Received:
    5
    Home Page:
    hey do u know how to put only featured movies in carousel (i dont want to include un-featured movies)????????