defmodule PlausibleWeb.Live.Installation.Instructions do
@moduledoc """
Instruction forms and components for the Installation module
"""
use PlausibleWeb, :component
attr :tracker_script_configuration_form, :map, required: true
def manual_instructions(assigns) do
~H"""
<.title class="mt-4">
Script installation
We've detected your website is using WordPress. Here's how to integrate Plausible:
Using Wordpress? Here's how to integrate Plausible:
<.focus_list>
<:item>
<.styled_link href="https://plausible.io/wordpress-analytics-plugin" new_tab={true}>
Install our WordPress plugin
<:item>
After activating our plugin, click the button below to verify your installation.
"""
end
attr :recommended_installation_type, :string, required: true
attr :tracker_script_configuration_form, :map, required: true
def gtm_instructions(assigns) do
~H"""
<.title class="mt-4">
Tag Manager installation
We've detected your website is using Google Tag Manager. Here's how to integrate Plausible:
Using Google Tag Manager? Here's how to integrate Plausible:
<.focus_list>
<:item>
Copy your site's Script ID:
<.snippet_form
text={@tracker_script_configuration_form.data.id}
rows={1}
resizable={false}
/>
<:item>
<.styled_link href="https://plausible.io/gtm-template" new_tab={true}>
Install the Plausible template in GTM
<:item>
Paste your Script ID into the template and click the button below to verify your installation.
"""
end
def npm_instructions(assigns) do
~H"""
<.title class="my-4">
NPM installation
<.focus_list>
<:item>
<.styled_link href="https://www.npmjs.com/package/@plausible-analytics/tracker" new_tab={true}>
Install @plausible-analytics/tracker NPM package
<:item>
Once done, click the button below to verify your installation.
"""
end
attr :field, :any, required: true
attr :label, :string, required: true
attr :tooltip, :string, required: true
attr :learn_more, :string, required: true
defp script_config_control(assigns) do
~H"""
<.input mt?={false} field={@field} label={@label} type="checkbox" />
<.tooltip sticky?={false}>
<:tooltip_content>
{@tooltip}
Click to learn more.
"""
end
defp advanced_option(assigns) do
~H"""