Best way to use Google Analytics in WB?

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Best way to use Google Analytics in WB?

Post 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?
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post 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.
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Re: Best way to use Google Analytics in WB?

Post 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.
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post 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'
User avatar
etcbbu
 
 
Posts: 460
Joined: Mon Apr 23, 2007 3:00 pm

Re: Best way to use Google Analytics in WB?

Post 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?
https://ktravisj.com

Travis J Consulting, LLC
⚫️Website Design/Development/Maintenance
⚫️Web-Marketing/Social Media
⚫️SEO/Search Engine Optimization

https://ktravisj.com
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post by Pablo »

Correct
User avatar
ColinM
 
 
Posts: 962
Joined: Wed Feb 09, 2011 3:40 am
Location: Western Australia

Re: Best way to use Google Analytics in WB?

Post 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)
Yours truly
Colin M
Western Australia
User avatar
tommy888
 
 
Posts: 214
Joined: Mon Sep 28, 2009 5:41 pm
Location: Poland
Contact:

Re: Best way to use Google Analytics in WB?

Post 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.
User avatar
protectourlands
 
 
Posts: 443
Joined: Sat May 24, 2008 2:16 am
Contact:

Re: Best way to use Google Analytics in WB?

Post 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.
ae_registration
 
 
Posts: 8
Joined: Wed Feb 01, 2017 8:24 am

Re: Best way to use Google Analytics in WB?

Post 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.
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post by Pablo »

If you added the code to the master frame then you will need to republish all pages that use the master frame.
ae_registration
 
 
Posts: 8
Joined: Wed Feb 01, 2017 8:24 am

Re: Best way to use Google Analytics in WB?

Post 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?
ae_registration
 
 
Posts: 8
Joined: Wed Feb 01, 2017 8:24 am

Re: Best way to use Google Analytics in WB?

Post 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?
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post by Pablo »

The code seems to be correct.
What is the URL of the page, so I can see what you have done?
ae_registration
 
 
Posts: 8
Joined: Wed Feb 01, 2017 8:24 am

Re: Best way to use Google Analytics in WB?

Post by ae_registration »

https://*.com/
Last edited by ae_registration on Sun Feb 24, 2019 12:43 pm, edited 1 time in total.
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post by Pablo »

The code is on the page, so it should be ok.
ae_registration
 
 
Posts: 8
Joined: Wed Feb 01, 2017 8:24 am

Re: Best way to use Google Analytics in WB?

Post 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?
User avatar
Pablo
 
Posts: 21577
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Best way to use Google Analytics in WB?

Post 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.
petertj
 
 
Posts: 35
Joined: Thu Apr 12, 2012 11:18 am

Re: Best way to use Google Analytics in WB?

Post 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
User avatar
BaconFries
 
 
Posts: 5327
Joined: Thu Aug 16, 2007 7:32 pm

Re: Best way to use Google Analytics in WB?

Post by BaconFries »

Seems to be there when I view the source.
Image
petertj
 
 
Posts: 35
Joined: Thu Apr 12, 2012 11:18 am

Re: Best way to use Google Analytics in WB?

Post 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
User avatar
BaconFries
 
 
Posts: 5327
Joined: Thu Aug 16, 2007 7:32 pm

Re: Best way to use Google Analytics in WB?

Post 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.
petertj
 
 
Posts: 35
Joined: Thu Apr 12, 2012 11:18 am

Re: Best way to use Google Analytics in WB?

Post 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
Post Reply