maxandriani / ngx-google-analytics

An easy way to use and configure Google Analytics on Angular 6+ applications
MIT License
120 stars 49 forks source link

Question : how to make the search-console work #76

Closed rbalet closed 2 years ago

rbalet commented 2 years ago

I would like to analyze the performance of my website with the google website https://search.google.com/u/0/search-console/.

To do so, they give me different solutions image

I would like to be able to use Googel Analytics way of doing, since this is the code I have to give into the .forRoot() method.
I saw that, as answer to https://github.com/maxandriani/ngx-google-analytics/issues/71, it's mentioned that the "lib creates the snippet for you". But I won't see any script like that being rendered in the website, I assume this isn't needed, because this is basically a function that could be called within a class.

Does somebody find out how to make it work ?

maxandriani commented 2 years ago

Hi @rbalet. What is the error message did you get from Google Search integration?

The script snippet is in fact generated by the lib. But it is not rendered in the html processed by nginx/apache. It will create the snippet on the fly. You are able to check GA installation on Chrome's Developer Tools (f12), by tap on Console and type gtag() function.

You should consider that a ng application is a javascript program, and Google Search Engine have throubles to scan pure javascript application. You should use a Server Side Rendering (SSR) engine to make your website compatible w/ Google Search. But this lib have some limitations when you use SSR.

rbalet commented 2 years ago

Hi @maxandriani & thx for your answer.

We'll, I wanted to dig deeper to be able to share you the bug, but it worked on my search console.

Maybe it is just due to google taking time to crawl it.

But it did take longer than a week..

Sorry for the annoyance.