meetinghouse / cms

Laravel CMS
0 stars 3 forks source link

Google Analytics code - what pages are being tracked? #264

Open KathJohnson opened 8 years ago

KathJohnson commented 8 years ago

@acavanagh @1sp

I'm not sure which of you I should ask, so I've tagged both of you.

In issue #90, there was programming added that allows an administrator to enter a Google Analytics code in a site's interface. This successfully starts populating Google Analytics reports.

But now I'm not sure how, exactly, the data is getting collected. Google's instructions for adding a tracking code offer several options, some of which include adding a certain code scrap to every page you'd like tracked, or adding a certain code scrap to every php template page. There is Dynamic Content Implementation, which makes it so you don't have to manually add the code to every page you want tracked. (see attached screenshot of the options Google gives in Analytics).

I am now asking if the Google Analytics code I can set in the interface will lead to every page on the site being tracked, or if it is only being attached to one page (for instance, the homepage). Thanks.

jboz62 commented 8 years ago

Yes, that code will pick up every page, post, project, etc. that is on the site. If you go to any page or post on a site and view the source, you will see this script on there:

<script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-61650296-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>

However, that script should be updated as it's using the old version of Google Analytics, "ga.js", it should be using the Unversal Analytics "analytics.js". https://developers.google.com/analytics/devguides/collection/upgrade/

meetinghouse commented 8 years ago

Thank you, John. I am entering UA codes, so it is interesting that the code is using the old version of Analytics. Yes, let's get that changed. I will still have to back-burner that, though it is frustrating to have all this stuff building up, but we'll keep this issue open for followup.

Even with the old version it should be tracking numbers with some relationship to reality.

jboz62 commented 8 years ago

The code is in main.blade.php file that needs to be updated. What happens is when you enter the ID in the admin, it just gets dynamically added into the code. So all of the sites use the same code with their specific ID added in.

<script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', '{{$settings->google_analytics}}']); <<------- HERE
    _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>
jboz62 commented 8 years ago

Once we figure out what's going on with the deployment, this is an easy fix. What's happening on that? Do we have Sudhir working on it yet?

meetinghouse commented 8 years ago

I have the word out to him now on that, starting with installing a logger on the server and doing a test deployment to look for why the Forge deployment is squirrely. That is the first bottleneck to tackle, from where I'm sitting.

Sincerely, Katherine Johnson, Research Director Corbett Research Group http://www.restorationtrades.com "Web Marketing that Works"

Publishers of:

The Custom Building & Restoration Trades Directory http://www.restorationtradesdirectory.com

The Building Arts Notebook, "Journal of the Guild of Building Artisans" http://buildingartisansguild.com/

Email: katherine@restorationtrades.com Phone: (413) 475-3154

On Tue, Jun 14, 2016 at 2:36 PM, jboz62 notifications@github.com wrote:

Once we figure out what's going on with the deployment, this is an easy fix. What's happening on that? Do we have Sudhir working on it yet?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/meetinghouse/cms/issues/264#issuecomment-225975503, or mute the thread https://github.com/notifications/unsubscribe/AE-WlVIFIh6G-Q6VKhDlGV9M6Jqqx6Unks5qLvTFgaJpZM4I1kny .

KathJohnson commented 8 years ago

@jboz62, as Sudhir appears to be still out of commission, can we talk about this? It looks like the Google analytics-measured traffic to NES is off -- it is unbelievably low.

I'm thinking that if we correct the code to the correct version, as you suggested, it may fix it.

Now, without Sudhir around, is it possible for you and me to get this done? I don't want to do it just for one site, because that way lies danger, but if it is an easy and fairly foolproof bit of code, then it seems like it could be safe. For the moment, the deploy bug appears to be resolved (though I am keeping an eye out for it), so we can deploy to a test site first. What do you think about this?

acavanagh commented 8 years ago

it should be pretty easy and painless to deploy the new code.

On Tue, Jun 28, 2016 at 10:56 AM KathJohnson notifications@github.com wrote:

@jboz62 https://github.com/jboz62, as Sudhir appears to be still out of commission, can we talk about this? It looks like the Google analytics-measured traffic to NES is off -- it is unbelievably low.

I'm thinking that if we correct the code to the correct version, as you suggested, it may fix it.

Now, without Sudhir around, is it possible for you and me to get this done? I don't want to do it just for one site, because that way lies danger, but if it is an easy and fairly foolproof bit of code, then it seems like it could be safe. For the moment, the deploy bug appears to be resolved (though I am keeping an eye out for it), so we can deploy to a test site first. What do you think about this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/meetinghouse/cms/issues/264#issuecomment-229075259, or mute the thread https://github.com/notifications/unsubscribe/AB5vMN5k500KyyvfTmEcM9utSvC69PO3ks5qQTYrgaJpZM4I1kny .

jboz62 commented 8 years ago

@KathJohnson were there a lot of old links on Google for NES that are now broken with the new site? That could be causing some of the problem with lower traffic. I'm not sure how you've been handling URL redirects in the past. Usually, you would add some 301 redirects to the .htaccess file to correct any bad links on Google until it picks up the the new URLs on the site.

Aside from that, yes, we can do update the code, but have the current code changes for the menu been deployed to all the sites? I'm a bit out of touch as to where we are with the current state of things on the repository.

acavanagh commented 8 years ago

@jboz62 has a point - the old tracking code would not support new features, but I'd be somewhat surprised if it's inaccurate.

On Tue, Jun 28, 2016 at 11:05 AM jboz62 notifications@github.com wrote:

@KathJohnson https://github.com/KathJohnson were there a lot of old links on Google for NES that are now broken with the new site? That could be causing some of the problem with lower traffic. I'm not sure how you've been handling URL redirects in the past. Usually, you would add some 301 redirects to the .htaccess file to correct any bad links on Google until it picks up the the new URLs on the site.

Aside from that, yes, we can do update the code, but have the current code changes for the menu been deployed to all the sites? I'm a bit out of touch as to where we are with the current state of things on the repository.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/meetinghouse/cms/issues/264#issuecomment-229078315, or mute the thread https://github.com/notifications/unsubscribe/AB5vMKc77OiEQ33V6KpJ79V3oK5XicQNks5qQThXgaJpZM4I1kny .

jboz62 commented 8 years ago

Here’s an example of a bad link on Google: http://www.newenglandsoundproofing.com/product_catalog http://www.newenglandsoundproofing.com/product_catalog

On Jun 28, 2016, at 10:56 AM, KathJohnson notifications@github.com wrote:

@jboz62 https://github.com/jboz62, as Sudhir appears to be still out of commission, can we talk about this? It looks like the Google analytics-measured traffic to NES is off -- it is unbelievably low.

I'm thinking that if we correct the code to the correct version, as you suggested, it may fix it.

Now, without Sudhir around, is it possible for you and me to get this done? I don't want to do it just for one site, because that way lies danger, but if it is an easy and fairly foolproof bit of code, then it seems like it could be safe. For the moment, the deploy bug appears to be resolved (though I am keeping an eye out for it), so we can deploy to a test site first. What do you think about this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/meetinghouse/cms/issues/264#issuecomment-229075259, or mute the thread https://github.com/notifications/unsubscribe/ALMf8IWu_l0XkcAEXLKs1I0biTajz-QYks5qQTYrgaJpZM4I1kny.

jboz62 commented 8 years ago

The site seems to be getting picked up on Google, there’s a mix of old links and some new ones…most are new. I searched for "new england sound proofing Easton MA”

On Jun 28, 2016, at 10:56 AM, KathJohnson notifications@github.com wrote:

@jboz62 https://github.com/jboz62, as Sudhir appears to be still out of commission, can we talk about this? It looks like the Google analytics-measured traffic to NES is off -- it is unbelievably low.

I'm thinking that if we correct the code to the correct version, as you suggested, it may fix it.

Now, without Sudhir around, is it possible for you and me to get this done? I don't want to do it just for one site, because that way lies danger, but if it is an easy and fairly foolproof bit of code, then it seems like it could be safe. For the moment, the deploy bug appears to be resolved (though I am keeping an eye out for it), so we can deploy to a test site first. What do you think about this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/meetinghouse/cms/issues/264#issuecomment-229075259, or mute the thread https://github.com/notifications/unsubscribe/ALMf8IWu_l0XkcAEXLKs1I0biTajz-QYks5qQTYrgaJpZM4I1kny.

KathJohnson commented 8 years ago

I demoted several links in Google WMT to avoid having them show up. John B says he will turn off the debugger for this site (so anyone stumbling onto bad links gets a regualr 404 page instead of the scary-looking debugger page), and I will watch for a couple of days to see if G-A traffic goes up after demoting the pages.

I think there is an issue with this site of the old page structure being at least partially abandoned, and formerly indexed pages not existing anymore. Hopefully there will be a steady, natural improvment.

The traffic measured at the server did not change much (a drop from 5200 to about 5000 visits).

acavanagh commented 8 years ago

if the traffic on the server is different than the traffic reported by google then it might really be that the old code is under-reporting. Should also make sure that it's really on every page, although I think they all use the same template so it should be. Lastly, that debug stuff should definitely be of as soon as possible on ALL the sites. It's a minor, though real, security risk.

On Tue, Jun 28, 2016 at 1:37 PM KathJohnson notifications@github.com wrote:

I demoted several links in Google WMT to avoid having them show up. John B says he will turn off the debugger for this site (so anyone stumbling onto bad links gets a regualr 404 page instead of the scary-looking debugger page), and I will watch for a couple of days to see if G-A traffic goes up after demoting the pages.

I think there is an issue with this site of the old page structure being at least partially abandoned, and formerly indexed pages not existing anymore. Hopefully there will be a steady, natural improvment.

The traffic measured at the server did not change much (a drop from 5200 to about 5000 visits).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/meetinghouse/cms/issues/264#issuecomment-229123989, or mute the thread https://github.com/notifications/unsubscribe/AB5vMK9uyOCwZreByavtMgaMRvsXQus_ks5qQVvTgaJpZM4I1kny .

meetinghouse commented 8 years ago

Who is best able to accomplish the following? (1) Check to see that the G-A tracking code is on every page, and go ahead and (2) update the code to the new version?

I created a separate GitHub issue for the turning off of the debugger. It is probably somethign I could manage if I have some direction on how to do it.

KathJohnson commented 8 years ago

Whaaaaat??! I updated the UA code for New England Soundproofing on June 7th. I did a check of several pages to see if they all had the code applied, and found that only the homepage had it applied.

Aha! I thought. So I went into the interface and looked at the Google tracking code, thinking to update it again there and then see if would then go to all the pages of the site. ODDLY, the field in the interface was blank. That doesn't make sense, as it was actually in the homepage, so maybe it's a display thing.

I updated the UA code there and now I am seeing it applied to the homepage and other pages on the site.

Hopefully this will fix his low pageviews problem. I'm concerned that the code appears to have been deleted from everywhere excep the homepage. I have not successfully reproduced this, though. I will keep an eye on this. I don't see it happening to any other sites.

KathJohnson commented 8 years ago

I'm going to backburner this for now, and I can check back in after the holiday. Assuming the UA code doesn't get removed from any pages, I suppose that Steve's numbers will start showing as expected on his reports.