{% extends 'user.twig' %}

{% block head %}
    {{ parent() }}
    <link rel="stylesheet" href="plugins/CoreAdminHome/stylesheets/jsTrackingGenerator.css" />
    <script type="text/javascript" src="plugins/CoreAdminHome/javascripts/jsTrackingGenerator.js"></script>
{% endblock %}


{% set title %}{{ 'CoreAdminHome_JavaScriptTracking'|translate }}{% endset %}

{% block content %}
<div id="js-tracking-generator-data" max-custom-variables="{{ maxCustomVariables|e('html_attr') }}" data-currencies="{{ currencySymbols|json_encode }}"></div>

<h2 piwik-enriched-headline
    feature-name="{{ 'CoreAdminHome_TrackingCode'|translate }}"
    help-url="http://piwik.org/docs/tracking-api/">{{ title }}</h2>

<div id="js-code-options">

    <p>
        {{ 'CoreAdminHome_JSTrackingIntro1'|translate }}
        <br/><br/>
        {{ 'CoreAdminHome_JSTrackingIntro2'|translate }} {{ 'CoreAdminHome_JSTrackingIntro3'|translate('<a href="http://piwik.org/integrate/" rel="noreferrer"  target="_blank">','</a>')|raw }}
        <br/><br/>
        {{ 'CoreAdminHome_JSTrackingIntro4'|translate('<a href="#image-tracking-link">','</a>')|raw }}
        <br/><br/>
        {{ 'CoreAdminHome_JSTrackingIntro5'|translate('<a rel="noreferrer"  target="_blank" href="http://piwik.org/docs/javascript-tracking/">','</a>')|raw }}
    </p>

    <div class="form-group">
        {# website #}
        <label>{{ 'General_Website'|translate }}</label>

        <div piwik-siteselector
             class="sites_autocomplete"
             siteid="{{ idSite }}"
             sitename="{{ defaultReportSiteName }}"
             show-all-sites-item="false"
             switch-site-on-select="false"
             id="js-tracker-website"
             show-selected-site="true"></div>
    </div>

    <h3>{{ 'General_Options'|translate }}</h3>

    <div id="optional-js-tracking-options">

        {# track across all subdomains #}
        <div class="form-group">
            <div class="form-help">
                {{ 'CoreAdminHome_JSTracking_MergeSubdomainsDesc'|translate("x.<span class='current-site-host'>"~defaultReportSiteDomain~"</span>","y.<span class='current-site-host'>"~defaultReportSiteDomain~"</span>")|raw }}
                {{ 'General_LearnMore'|translate(' (<a href="http://developer.piwik.org/guides/tracking-javascript-guide#measuring-domains-andor-sub-domains" rel="noreferrer"  target="_blank">', '</a>)')|raw }}
            </div>
            <label class="checkbox">
                <input type="checkbox" id="javascript-tracking-all-subdomains"/>
                {{ 'CoreAdminHome_JSTracking_MergeSubdomains'|translate }}
                <span class='current-site-name'>{{ defaultReportSiteName|raw }}</span>
            </label>
        </div>

        {# group page titles by site domain #}
        <div class="form-group">
            <div class="form-help">
                {{ 'CoreAdminHome_JSTracking_GroupPageTitlesByDomainDesc1'|translate("<span class='current-site-host'>" ~ defaultReportSiteDomain ~ "</span>")|raw }}
            </div>
            <label class="checkbox">
                <input type="checkbox" id="javascript-tracking-group-by-domain"/>
                {{ 'CoreAdminHome_JSTracking_GroupPageTitlesByDomain'|translate }}
            </label>
        </div>

        {# track across all site aliases #}
        <div class="form-group">
            <div class="form-help">
                {{ 'CoreAdminHome_JSTracking_MergeAliasesDesc'|translate("<span class='current-site-alias'>"~defaultReportSiteAlias~"</span>")|raw }}
            </div>
            <label class="checkbox">
                <input type="checkbox" checked="checked" id="javascript-tracking-all-aliases"/>
                {{ 'CoreAdminHome_JSTracking_MergeAliases'|translate }}
                <span class='current-site-name'>{{ defaultReportSiteName|raw }}</span>
            </label>
        </div>

        <h3>{{ 'Mobile_Advanced'|translate }}</h3>

        <p>
            <a href="#" class="section-toggler-link" data-section-id="javascript-advanced-options">{{ 'General_Show'|translate }}</a>
        </p>

        <div id="javascript-advanced-options" style="display:none;">

            {# visitor custom variable #}
            <div id="javascript-tracking-visitor-cv">
                <div class="form-group">
                    <div class="form-help">
                        {{ 'CoreAdminHome_JSTracking_VisitorCustomVarsDesc'|translate }}
                    </div>
                    <label class="checkbox">
                        <input class="section-toggler-link" type="checkbox" id="javascript-tracking-visitor-cv-check" data-section-id="js-visitor-cv-extra"/>
                        {{ 'CoreAdminHome_JSTracking_VisitorCustomVars'|translate }}
                    </label>
                </div>
                <table id="js-visitor-cv-extra" style="display:none;">
                    <tr>
                        <th>{{ 'General_Name'|translate }}</th>
                        <th>{{ 'General_Value'|translate }}</th>
                    </tr>
                    <tr>
                        <td><input type="text" class="custom-variable-name" placeholder="e.g. Type"/></td>
                        <td><input type="text" class="custom-variable-value" placeholder="e.g. Customer"/></td>
                    </tr>
                    <tr>
                        <td colspan="4" style="text-align:right;">
                            <a href="#" class="add-custom-variable">{{ 'General_Add'|translate }}</a>
                        </td>
                    </tr>
                </table>
            </div>

            {# do not track support #}
            <div class="form-group">
                <div class="form-help">
                    {{ 'CoreAdminHome_JSTracking_EnableDoNotTrackDesc'|translate }}
                    {% if serverSideDoNotTrackEnabled %}
                        <br/>
                        {{ 'CoreAdminHome_JSTracking_EnableDoNotTrack_AlreadyEnabled'|translate }}
                    {% endif %}
                </div>
                <label class="checkbox">
                    <input type="checkbox" id="javascript-tracking-do-not-track"/>
                    {{ 'CoreAdminHome_JSTracking_EnableDoNotTrack'|translate }}
                </label>
            </div>

            {# disable all cookies options #}
            <div class="form-group">
                <div class="form-help">
                    {{ 'CoreAdminHome_JSTracking_DisableCookiesDesc'|translate }}
                </div>
                <label class="checkbox">
                    <input type="checkbox" id="javascript-tracking-disable-cookies"/>
                    {{ 'CoreAdminHome_JSTracking_DisableCookies'|translate }}
                </label>
            </div>

            {# custom campaign name/keyword query params #}
            <div class="form-group">
                <div class="form-help">
                    {{ 'CoreAdminHome_JSTracking_CustomCampaignQueryParamDesc'|translate('<a href="http://piwik.org/faq/general/#faq_119" rel="noreferrer"  target="_blank">','</a>')|raw }}
                </div>
                <label class="checkbox">
                    <input class="section-toggler-link" type="checkbox"
                           id="custom-campaign-query-params-check"
                           data-section-id="js-campaign-query-param-extra"/>
                    {{ 'CoreAdminHome_JSTracking_CustomCampaignQueryParam'|translate }}
                </label>
            </div>
            <div style="display:none;" id="js-campaign-query-param-extra">
                <div class="form-group">
                    <label>{{ 'CoreAdminHome_JSTracking_CampaignNameParam'|translate }}</label>
                    <input type="text" id="custom-campaign-name-query-param"/>
                </div>
                <div class="form-group">
                    <label>{{ 'CoreAdminHome_JSTracking_CampaignKwdParam'|translate }}</label>
                    <input type="text" id="custom-campaign-keyword-query-param"/>
                </div>
            </div>

        </div>

    </div>

</div>

<div id="javascript-output-section">
    <h3>{{ 'General_JsTrackingTag'|translate }}</h3>

    <p>{{ 'CoreAdminHome_JSTracking_CodeNoteBeforeClosingHead'|translate("&lt;/head&gt;")|raw }}</p>

    <div id="javascript-text">
        <textarea class="codeblock"> </textarea>
    </div>
</div>

<h2 id="image-tracking-link">{{ 'CoreAdminHome_ImageTracking'|translate }}</h2>

<div id="image-tracking-code-options">

    <p>
        {{ 'CoreAdminHome_ImageTrackingIntro1'|translate }} {{ 'CoreAdminHome_ImageTrackingIntro2'|translate("<em>&lt;noscript&gt;&lt;/noscript&gt;</em>")|raw }}
    </p>
    <p>
        {{ 'CoreAdminHome_ImageTrackingIntro3'|translate('<a href="http://piwik.org/docs/tracking-api/reference/" rel="noreferrer"  target="_blank">','</a>')|raw }}
    </p>

    {# website #}
    <div class="form-group">
        <label>{{ 'General_Website'|translate }}</label>
        <div piwik-siteselector
             class="sites_autocomplete"
             siteid="{{ idSite }}"
             sitename="{{ defaultReportSiteName }}"
             id="image-tracker-website"
             show-all-sites-item="false"
             switch-site-on-select="false"
             show-selected-site="true"></div>
    </div>

    <h3>{{ 'General_Options'|translate }}</h3>

    <div id="image-tracking-section">

        {# action_name #}
        <div class="form-group">
            <label for="image-tracker-action-name">{{ 'Actions_ColumnPageName'|translate }}</label>
            <input type="text" id="image-tracker-action-name"/>
        </div>

        {# goal #}
        <div class="form-group">
            <label class="checkbox">
                <input class="section-toggler-link" type="checkbox" id="image-tracking-goal-check" data-section-id="image-goal-picker-extra"/>
                {{ 'CoreAdminHome_TrackAGoal'|translate }}
            </label>
        </div>
        <div class="form-group" style="display:none;" id="image-goal-picker-extra">
            <select id="image-tracker-goal">
                <option value="">{{ 'UserCountryMap_None'|translate }}</option>
            </select>
            <span>{{ 'CoreAdminHome_WithOptionalRevenue'|translate }}</span>
            <div class="input-group">
                <input type="text" class="revenue" value=""/>
                <span class="input-group-addon">{{ defaultSiteRevenue }}</span>
            </div>
        </div>

    </div>

    <div id="image-link-output-section">
        <h3>{{ 'CoreAdminHome_ImageTrackingLink'|translate }}</h3>

        <div id="image-tracking-text">
            <textarea class="codeblock"> </textarea>
        </div>
    </div>

</div>

<h2>{{ 'CoreAdminHome_ImportingServerLogs'|translate }}</h2>

<p>
    {{ 'CoreAdminHome_ImportingServerLogsDesc'|translate('<a href="http://piwik.org/log-analytics/" rel="noreferrer"  target="_blank">','</a>')|raw }}
</p>

{% endblock %}
