johppann Posted October 5, 2016 Share Posted October 5, 2016 I am new to PW and have a client who use it for their website. I am trying to figure out where do I place the GA code and Ad Roll code in PW? Any help would be appreciated. Thanks, John Link to comment Share on other sites More sharing options...
Tom. Posted October 5, 2016 Share Posted October 5, 2016 Same place you would any other website, in the <head> part of your website. You will likely find this in /site/templates/ Thanks, Tom 4 Link to comment Share on other sites More sharing options...
adrian Posted October 5, 2016 Share Posted October 5, 2016 39 minutes ago, johppann said: I am new to PW and have a client who use it for their website. I am trying to figure out where do I place the GA code and Ad Roll code in PW? Any help would be appreciated. Hi John and welcome to PW! To expand on what Tom said, you might be looking for a head.php template file, or perhaps it will be in main.php or something along those lines. PW doesn't control your frontend markup at all, so there is no way to know for certain how the previous developer set things up, but what you are looking for a a template file that is included in all the page specific template files, or one that itself includes the other ones. 3 Link to comment Share on other sites More sharing options...
Macrura Posted October 6, 2016 Share Posted October 6, 2016 usually you put google analytics in the footer since it is a script tag 1 Link to comment Share on other sites More sharing options...
adrian Posted October 6, 2016 Share Posted October 6, 2016 36 minutes ago, Macrura said: usually you put google analytics in the footer since it is a script tag In this case, Google recommends just in the head, or after the opening body tag: Quote In practice, the Google Analytics code will work regardless of where you put it on the page. We recommend inserting it in the <head> section or after the opening <body> tag if possible. This is because the higher up it is inserted in your page source code, the sooner it will get executed after the user lands on your page. If you put your Analytics tracking code at the bottom of your code, it will be the last piece of script to get executed. Sometimes, if the user navigates to another page before the page has finished loading, the tag may not have time to fire and the data you collect will be less accurate. That's why the best practice is to put the tag towards the top of your page code. Also - keep in mind that the tag is designed to work asynchronously, therefore, it will have no impact on your page load time. Hope that clarifies the issue. Lothaire from the Google Analytics Academy Staff Quote Paste your tracking code snippet into its own include file, then include it in your page header, so that the snippet appears before the closing </head> tag on every web page on your site you wish to track. 4 Link to comment Share on other sites More sharing options...
Macrura Posted October 6, 2016 Share Posted October 6, 2016 thanks for correcting me; i was going by what I've seen on the majority of sites, as well as the HTML5 boilerplate, so i was blindly following the crowd, and i think google changed their instructions at some point also. 2 Link to comment Share on other sites More sharing options...
adrian Posted October 6, 2016 Share Posted October 6, 2016 7 minutes ago, Macrura said: i think google changed their instructions at some point also. I think you're right! 1 Link to comment Share on other sites More sharing options...
johppann Posted October 6, 2016 Author Share Posted October 6, 2016 So I am assuming that you need to put the php GA code in the header? or would I need to make a file with the google analytics code in there and put the php GA code in the header so it points there. Link to comment Share on other sites More sharing options...
cstevensjr Posted October 6, 2016 Share Posted October 6, 2016 53 minutes ago, johppann said: So I am assuming that you need to put the php GA code in the header? That should be all you need. Please try it out and see for yourself. 2 Link to comment Share on other sites More sharing options...
johppann Posted October 7, 2016 Author Share Posted October 7, 2016 Thank you to everyone! All of you all's help led me to the right place! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now