Page 1 of 1

Best way to use Google Analytics in WB?

Posted: Wed Apr 18, 2018 6:59 am
by etcbbu
(the last few posts on this page will give you the best insight into what we were talking about in another topic on the wrong board : viewtopic.php?f=59&t=80288 )

But here is what I am trying to figure out right now:

So, what I have done in my .WBS file, in my WB project, just now is gone to the page of my website called

"masterpage1"

This page is set to NOT PUBLISH, but it is a "Master Object" that is called on every page of my website. So I now went to that Page, and, using the top-ribbon, I clicked

"Page" >> "Google Analytics" >>

I cleared out the line that says

"

Code: Select all

<!-- Insert Google Analytics code here -->
"

there, and simply pasted the Google Analytics code for my property, that I get when I log in to Google Analytics and click

"Options" >> "Tracking Info" >> "Tracking Code"

And literally just copy/pasted that entire snippet in place of the
"

Code: Select all

<!-- Insert Google Analytics code here -->
" mentioned above.

I then went to that same "masterpage1" and deleted-out the old way I was doing it, where I was using an HTML object to paste the Google Analytics snippet in an "HTML Object", on the page, in WB.

Then, I published my entire project, meaning, re-published every page of my website that calls the "masterpage1" page *which is set to not-publish* , but which also follows that method that @ColinM told me, which had me put the snippet into the Page >> Google Analytics location.

Am I to expect this is the best way to do this?

Because now, when I am in my .WBS file, and I now go to the individual pages of my website, and I use the top options

Page >> Google Analytics

Certainly, those all still say

"

Code: Select all

<!-- Insert Google Analytics code here -->
"

since I was thinking that @ColinM was saying that I only need to do it in the one spot, in the "masterpage1" Page >> Google Analytics spot?

Under this setting, when I visit my pages right now, I am not seeing myself show up as "Live Traffic", like I was, previously, whenever I was using an HTML Object on every page, to have the Google Analytics code.

Are my two options:

1) either now start publishing "masterpage1" Master Object, since it now has this Google Analytics Code in the Page >> Google Analytics location?

2) keep not-publishing "masterpage1" Master Object, but then go through and Manually paste-in the Google Analytics snippet one-by-one, page-by-page, doing the Page >> Google Analytics option for every page of the website?

Or is there something else I am missing?

Re: Best way to use Google Analytics in WB?

Posted: Wed Apr 18, 2018 7:54 am
by Pablo
Master objects do not include Page HTML or Page Properties, only the object will be included.
If you want to add HTML code to a master page then you will need to use the HTML object.

Re: Best way to use Google Analytics in WB?

Posted: Wed Apr 18, 2018 7:02 pm
by etcbbu
ColinM was telling me, here:

http://wysiwygwebbuilder.com/forum/view ... 59&t=80288

That it's best to put the Google Analytics code snippet in "Head" of the masterpage that undergirds all pages of the website, and then publish the masterpage.

Whereas, I was more saying that I've never published my Master Objects in any of my projects that serve as my masterpages that comprise my headers and footers and stuff like that, which are called on every page of my website projects, because I'd rather not publish extra php or .html pages on my web-space for SEO purposes. So I'm going to use this method of pasting the Google analytics code, page-by-page, on every project, in that "Head" area, one-by-one. Does this sound like an acceptable way to use Google Analytics in my WB projects? I would just like to know, for sure, moving forward, because I will probably roll this out to multiple projects, if so.

Re: Best way to use Google Analytics in WB?

Posted: Wed Apr 18, 2018 7:36 pm
by Pablo
- you do not need to publish the master page.
- if you want to add the code to a master page then it should be in an HTML object, set to 'between head tags'

Re: Best way to use Google Analytics in WB?

Posted: Wed Apr 18, 2018 7:44 pm
by etcbbu
Ok, I see what you are saying there; so I can either

- go page-by-page and use the Page >> Google Analytics and paste the code snippet there

- continue to use the HTML object on a masterpage, but just make sure I edit the Properties of the HTML Object, and edit the Type to be set to "Between <head></head> tags"

And those are kind of the two different ways it can be done in WB?

Re: Best way to use Google Analytics in WB?

Posted: Wed Apr 18, 2018 8:18 pm
by Pablo
Correct

Re: Best way to use Google Analytics in WB?

Posted: Thu Apr 19, 2018 7:51 am
by ColinM
Pablo wrote: Wed Apr 18, 2018 7:36 pm - you do not need to publish the master page.
- if you want to add the code to a master page then it should be in an HTML object, set to 'between head tags'
Thank you Pablo for the correction - apologies etchbu 8)

Re: Best way to use Google Analytics in WB?

Posted: Thu Apr 19, 2018 9:22 am
by tommy888
There's no need to add Google tracking code to master pages as well as publishing them as Pablo said.
Add the code to each page you want to have tracked by Google Analytics bots in <head></head> section. To make them indexable use robots.txt file or WB12 page settings. Robots.txt is preferred by Google.

Re: Best way to use Google Analytics in WB?

Posted: Fri Apr 20, 2018 1:58 pm
by protectourlands
You can also use the built in Google Analytics tool under the Page tab.

I prefer to use the Site HTML tool also under the Page tab. This way yo can apply the snippet to all pages in one step instead of having to insert it page by page.

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 9:09 am
by ae_registration
Does it apply to the project with unpublished master frame page used on every page of the site? I've tried to insert snippet into Meta Tags, html properties between <body> on every page, even only on master frame page. But didn't get GA working. It continues to show 0 online. Is there exist an exact manual for usual html pages using master frame objects? Thank you.

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 10:19 am
by Pablo
If you added the code to the master frame then you will need to republish all pages that use the master frame.

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 10:39 am
by ae_registration
Yes, the sequencing was the following:
1. I've created google analytics account
2. Got my tracking code.
3. Inserted it to the html code of the master frame using Google Analytics property
4. Then save the project and republished it (entire site and Publish html files only options)
5. After that I see 0 activity on the GA page, but there are a few users used this site.

Also I've tried to manually add code in some pages (between head option), tried to add meta tags option of the site... Nothing helps. Option "Generate external JS file..." is off. What else could be wrong?

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 11:07 am
by ae_registration
One more thing. I've generated html output locally to see the code. The part of it is the following:

</style>
<!-- Insert Google Analytics code here --><!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/j ... "></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-135071129-1');
</script>

</head>

Are there no mistakes? Empty line after /script tag and between gtag()'s... Is it ok?
Also. GA says that this code must be put right after the <head> tag and WWB puts it before closing </head>. Is it ok?

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 11:17 am
by Pablo
The code seems to be correct.
What is the URL of the page, so I can see what you have done?

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 11:27 am
by ae_registration
https://*.com/

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 12:41 pm
by Pablo
The code is on the page, so it should be ok.

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 12:43 pm
by ae_registration
Yes, I see it works. I saw you've entered the site. Well, I suppose that the problem was in my browser settings? I use incognito mode and tracking is forbidden. Possible that was the problem?

Re: Best way to use Google Analytics in WB?

Posted: Sun Feb 24, 2019 1:30 pm
by Pablo
Yes, that may be related.

Note that this is not specific to the application.
The code will be published "AS IS". The behavior of the script is controlled by Google.

Re: Best way to use Google Analytics in WB?

Posted: Fri Sep 27, 2019 7:31 am
by petertj
Hi Pablo,

I've pasted the Analytics code

===========================================================
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/j ... "></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-XXXXXXXX-1);
</script>
===========================================================

into the "between head tags" but no sign of it turns up in the View Source of the published page.

URL : https://www.learnus.co.uk/index.html

Suggestions are welcome (as always)

Peter

Re: Best way to use Google Analytics in WB?

Posted: Fri Sep 27, 2019 10:03 am
by BaconFries
Seems to be there when I view the source.
Image

Re: Best way to use Google Analytics in WB?

Posted: Fri Sep 27, 2019 11:36 am
by petertj
You are right Baconfries but instead of being where I would expect to have seen code within "the <HEAD> at the upper part of the page it is one of a number <Head>s very near the end.

The primary reason that I wanted to see what what was going on is that Google Analytics is not 'communicating' with this tag avcording to their own test process.

Peter

Re: Best way to use Google Analytics in WB?

Posted: Fri Sep 27, 2019 11:44 am
by BaconFries
Then its possible that you have selected "Move JavaScript to the end of the page". Go to Tools-> Options -> HTML and deselect this and view the source.

Re: Best way to use Google Analytics in WB?

Posted: Fri Sep 27, 2019 12:01 pm
by petertj
The Google code code was taken directly from the Analytics page and inserted using the Page/Google Analytics method.

The Options settings are still on default and I don't recall ever having changing them.

Could it be something to do with the use of Flex Grid?

I don't mind about where WB puts the Analytics stuff, I only want Analytics to recognise its own ID.

Any further help would be appreciated.

Peter