% use Plausible %>
<.settings_tiles>
<.tile docs="google-search-console-integration">
<:title>
Google Search Console integration
<:subtitle>
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.
<%= if Keyword.get(Application.get_env(:plausible, :google), :client_id) do %>
<%= if @site.google_auth do %>
<.input
name="account"
label="Linked Google account"
value={@site.google_auth.email}
disabled="disabled"
width="w-1/2"
mt?={false}
/>
<.button_link
theme="danger"
href={Routes.site_path(@conn, :delete_google_auth, @site.domain)}
method="delete"
>
Unlink Google account
<%= case @search_console_domains do %>
<% {:ok, domains} -> %>
<%= if @site.google_auth.property && !(@site.google_auth.property in domains) do %>
<.notice class="mt-4 mb-4">
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.
<% else %>
Select the Google Search Console property you would like to pull keyword data from. If you don't see your domain,
<.styled_link
href="https://plausible.io/docs/google-search-console-integration"
new_tab={true}
>
set it up and verify
on Search Console first.
<% end %>
<.form
:let={f}
for={Plausible.Site.GoogleAuth.changeset(@site.google_auth)}
class="max-w-xs"
action={"/#{URI.encode_www_form(@site.domain)}/settings/google"}
>
<.button type="submit">Save
<% {:error, error} -> %>
<.notice title="Integration error" theme={:red} class="mt-8">
<%= case error do %>
<% "invalid_grant" -> %>
Invalid Grant error returned from Google.
<.styled_link
new_tab={true}
href="https://plausible.io/docs/google-search-console-integration#i-get-the-invalid-grant-error"
>
See here on how to fix it
<% "google_auth_error" -> %>
Your Search Console account hasn't been connected successfully. Please unlink your Google account and try linking it again.
<% _ -> %>
Something went wrong, but looks temporary. If the problem persists, try re-linking your Google account.
<% end %>
<% end %>
<% else %>
NB: You also need to set up your site on
<.styled_link href="https://search.google.com/search-console/about" new_tab={true}>
Google Search Console
for the integration to work.
<.styled_link
href="https://plausible.io/docs/google-search-console-integration"
new_tab={true}
>
Read the docs
<% end %>
<% else %>
An extra step is needed to set up your {Plausible.product_name()} for the Google Search Console integration.
Find instructions
<.styled_link href="https://github.com/plausible/community-edition/wiki/google-integration">
here
<% end %>
<.tile :if={ee?()} docs="looker-studio">
<:title>
Google Looker Studio Connector
<:subtitle>
You can use our Looker Studio connector to build custom reports with your Plausible data.
Plausible Looker Studio Connector adds powerful reporting features that help turn Plausible
into an even better replacement for Google Analytics.
<.styled_link href="https://plausible.io/docs/looker-studio" new_tab={true}>
Read the docs