Configure Google Search Console property
parent
8d7e86c912
commit
731407f7b2
@ -0,0 +1,16 @@
|
||||
<%= form_for @conn, "/google", [class: "max-w-sm w-full mx-auto bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>
|
||||
<h2>Connect to property</h2>
|
||||
<p class="text-grey-dark mt-4">Select the Google Search Console property you would like to pull keyword data from</p>
|
||||
|
||||
<div class="my-6">
|
||||
<%= label f, :domain, class: "block text-grey-darker text-sm font-bold mb-2" %>
|
||||
<div class="inline-block relative w-full">
|
||||
<%= select f, :domain, @verified_domains, class: "block appearance-none w-full bg-grey-lighter text-grey-darker cursor-pointer hover:border-grey p-2 pr-8 rounded leading-normal focus:outline-none" %>
|
||||
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-red">
|
||||
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= submit "Enable Integration →", class: "button mt-4 w-full" %>
|
||||
<% end %>
|
||||
@ -0,0 +1,19 @@
|
||||
defmodule Plausible.Repo.Migrations.AddPropertyToGoogleAuth do
|
||||
use Ecto.Migration
|
||||
use Plausible.Repo
|
||||
|
||||
def change do
|
||||
alter table(:google_auth) do
|
||||
add :property, :text
|
||||
end
|
||||
|
||||
flush()
|
||||
|
||||
for auth <- Repo.all(Plausible.Site.GoogleAuth) do
|
||||
auth = Repo.preload(auth, :site)
|
||||
property = "https://#{auth.site.domain}"
|
||||
Plausible.Site.GoogleAuth.set_property(auth, %{property: property})
|
||||
|> Repo.update!
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue