{% extends "analytics/_layouts/settings" %} {% import "_includes/forms" as forms %} {% macro configWarning(setting, file) -%} {{ "This is being overridden by the {setting} config setting."|t({ setting: ''~setting~'' })|raw }} {%- endmacro %} {% from _self import configWarning %} {% set content %} {% if isOauthProviderConfigured %} {% if not oauthAccount %}

{{ 'Google Analytics Account'|t }}

{% if errors|length > 0 %} {% else %}

{{'You need to connect Craft to a Google account in order to get started.'|t}}

{% endif %} {% if token %}

{{'Disconnect'|t}}

{% else %}

{{"Getting errors trying to connect ?"|t}} {{"Check Google API key & secret in OAuth settings"|t}}.

{{"Connect to Google Analytics"|t}}

{% endif %} {% else %}

{{'Google Analytics Account'|t}}

{{'You are authenticated to Google Analytics with the following account'|t}} :

{{ provider.name }} OAuth provider
  • {{ 'Name'|t }} : {{ oauthAccount.name }}
  • {% if oauthAccount.uid is defined %}
  • {{ 'UID'|t }} : {{ oauthAccount.uid }}
  • {% elseif oauthAccount.id is defined %}
  • {{ 'UID'|t }} : {{ oauthAccount.id }}
  • {% endif %}
{% if settings.forceConnect %}

{{"Please connect again to Google Analytics"|t}}

{% else %}
{{ getCsrfInput() }}

{{ "Google Analytics View (Profile)"|t }}

{{ forms.selectField({ label: "Account"|t, name: 'settings[accountId]', class: 'account', options: accountOptions, value: accountId, }) }} {{ forms.selectField({ label: "Property"|t, name: 'settings[webPropertyId]', class: 'property', options: webPropertyOptions, value: webPropertyId, }) }} {{ forms.selectField({ label: "View"|t, name: 'settings[profileId]', class: 'view', options: viewOptions, value: viewId, }) }}
Refresh
{% includejs %} {% if accountExplorerData %} var forceRefresh = false; {% else %} var forceRefresh = true; {% endif %} var accountExplorer = new Analytics.AccountExplorer('#account-explorer', { forceRefresh: forceRefresh, data: {{ accountExplorerData|json_encode|raw }} }); {% endincludejs %}

{{'Realtime'|t}}

{{ forms.checkboxField({ label: "Enable real-time"|t, warning: (craft.config.get('enableRealtime', 'analytics') ? configWarning('enableRealtime')), name: 'settings[enableRealtime]', checked: (settings.enableRealtime ? settings.enableRealtime : false), toggle: 'enableRealtime' }) }}
{% endif %} {% endif %} {% else %}

{{'Google provider not configured'|t}}

{{'Please fill API client id & secret for Analytics provider.'|t}}

{{'Google OAuth settings'|t}}

{% endif %} {% endset %}