2020-12-16 12:57:28 +03:00
< div class = " shadow bg-white dark:bg-gray-800 sm:rounded-md sm:overflow-hidden py-6 px-4 sm:p-6 " >
2020-11-19 16:56:03 +03:00
< header class = " relative " >
2020-12-16 12:57:28 +03:00
< h2 class = " text-lg leading-6 font-medium text-gray-900 dark:text-gray-100 " > Google Search Console integration < / h2 >
< p class = " mt-1 text-sm leading-5 text-gray-500 dark:text-gray-200 " > You can integrate with Google Search Console to get all of your important search results stats such as keyword phrases people find your site with . < / p >
2020-11-19 16:56:03 +03:00
< % = link ( to : " https://docs.plausible.io/google-search-console-integration/ " , target : " _blank " ) do % >
< svg class = " w-6 h-6 absolute top-0 right-0 text-gray-400 " fill = " currentColor " viewBox = " 0 0 20 20 " xmlns = " http://www.w3.org/2000/svg " > < path fill - rule = " evenodd " d = " M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z " clip - rule = " evenodd " > < / path > < / svg >
< % end % >
2020-11-16 16:38:44 +03:00
< / header >
2021-01-15 11:12:00 +03:00
< % = if Keyword . get ( Application . get_env ( :plausible , :google ) , :client_id ) do % >
< % = if @site . google_auth do % >
< div class = " py-2 " > < / div >
< span class = " text-gray-700 dark:text-gray-300 " > Linked Google account : < b > < % = @site . google_auth . email % > < / b > < / span >
2020-11-16 16:38:44 +03:00
2021-01-15 11:12:00 +03:00
< % = link ( " Unlink Google account " , to : " / #{ URI . encode_www_form ( @site . domain ) } /settings/google " , class : " inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150 " , method : " delete " ) % >
2020-11-16 16:38:44 +03:00
2021-01-15 11:12:00 +03:00
< % = case @search_console_domains do % >
< % { :ok , domains } -> % >
< % = if @site . google_auth . property && ! ( @site . google_auth . property in domains ) do % >
< p class = " text-gray-700 dark:text-gray-300 mt-6 font-bold " >
NB : Your Google account does not have access to your currently configured property , < % = @site . google_auth . property % > . Please select a verified property from the list below .
< / p >
< % else % >
< p class = " text-gray-700 dark:text-gray-300 mt-6 " >
Select the Google Search Console property you would like to pull keyword data from . If you don ' t see your domain, <%= link("set it up and verify", to: "https://docs.plausible.io/google-search-console-integration", class: "text-indigo-500") %> on Search Console first.
< / p >
< % end % >
2020-11-16 16:38:44 +03:00
2021-01-15 11:12:00 +03:00
< % = form_for Plausible.Site.GoogleAuth . changeset ( @site . google_auth ) , " / #{ URI . encode_www_form ( @site . domain ) } /settings/google " , [ class : " max-w-xs " ] , fn f -> % >
< div class = " my-6 " >
< div class = " inline-block relative w-full " >
< % = select f , :property , domains , prompt : " (Choose property) " , class : " mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md " % >
< / div >
2020-11-16 16:38:44 +03:00
< / div >
2021-01-15 11:12:00 +03:00
< % = submit " Save " , class : " button " % >
< % end % >
2020-11-16 16:38:44 +03:00
< % { :error , error } -> % >
2020-12-16 12:57:28 +03:00
< p class = " text-gray-700 dark:text-gray-300 mt-6 " > The following error happened when fetching your Google Search Console domains . < / p >
2020-11-16 16:38:44 +03:00
< p class = " text-red-700 font-medium mt-3 " > < % = error % > < / p >
< % end % >
2021-01-15 11:12:00 +03:00
< % else % >
< % = button ( " Continue with Google " , to : Plausible.Google.Api . authorize_url ( @site . id ) , class : " button mt-8 " ) % >
< div class = " text-gray-700 dark:text-gray-300 mt-8 " >
NB : You also need to set up your site on < % = link ( " Google Search Console " , to : " https://search.google.com/search-console/about " ) % > for the integration to work . < % = link ( " Read the docs " , to : " https://docs.plausible.io/google-search-console-integration " , class : " text-indigo-500 " ) % >
< / div >
< % end % >
< % else % >
< div class = " my-8 text-center text-lg " >
< svg class = " block mx-auto mb-4 w-6 h-6 text-yellow-500 " fill = " none " stroke = " currentColor " viewBox = " 0 0 24 24 " xmlns = " http://www.w3.org/2000/svg " > < path stroke - linecap = " round " stroke - linejoin = " round " stroke - width = " 2 " d = " M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z " > < / path > < / svg >
2021-02-26 11:46:52 +03:00
< p class = " text-gray-900 dark:text-gray-200 " > An extra step is needed to set up your Plausible Analytics Self Hosted for the Google Search Console integration .
Find instructions < % = link ( " here " , to : " https://plausible.io/docs/self-hosting-configuration # google-search-integration " , class : " text-indigo-500 " ) % > < / p >
2021-01-15 11:12:00 +03:00
< / div >
< % end % >
2020-11-16 16:38:44 +03:00
< / div >