use_google_analytics

NAML documentation   Watch a video
   Usages of this macro
... in use_google_analytics.naml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<macro name="use_google_analytics" requires="servlet">
    <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.not
Binary
Namespace: BasicNamespace
Parameters: condition
.visitor
Binary
Namespace: ServletNamespace
Parameters: do
.is_site_admin
Macro
Requires: user
>
        <then>
            <n.login
Macro
Requires: servlet
Parameters: message
.><t>Only authorized users can proceed in this area.</t></n.login.>
        </then>
    </n.if.not.visitor.is_site_admin>
 
    <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.is_submitted_form
Macro
Requires: servlet
>
        <then>
            <n.catch_exception
Binary
Namespace: BasicNamespace
Parameters: id, do
. id="save-block">
                <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.is_valid_analytics_id
Macro
Parameters: code
.google_analytics_code_field
Macro
Parameters: do
.value
Binary
Namespace: FieldNamespace
>
                    <then>
                        <n.save_google_analytics_tweak
Macro
/>
                        <n.redirect_to
Binary
Namespace: ServletNamespace
Parameters: url
.root_node
Binary
Namespace: NabbleNamespace
Parameters: do
.url
Macro
Requires: node
Parameters: template, date, assignee, index_record, priority
/>
                    </then>
                    <else.throw_template_exception
Binary
Namespace: BasicNamespace
Parameters: name
 name="invalid_analytics_id"/>
                </n.if.is_valid_analytics_id.google_analytics_code_field.value>
            </n.catch_exception.>
        </then>
        <else>
            <n.google_analytics_code_field
Macro
Parameters: do
.set_value
Binary
Namespace: FieldNamespace
Parameters: value
 value="[n.naml_configuration
Binary
Namespace: NabbleNamespace
Parameters: do
.get_value
Binary
Namespace: NamlConfigurationNamespace
Parameters: default, name
 name='googleAnalyticsId' default=''/]"/>
        </else>
    </n.if.is_submitted_form>
 
    <n.html
Macro
Parameters: head, body
>
        <head>
            <meta name="robots" content="noindex,nofollow"/>
            <n.title
Macro
Parameters: text
.><t>Use Google Analytics</t></n.title.>
            <n.google_analytics_code_field
Macro
Parameters: do
.focus
Macro
Requires: field
/>
        </head>
        <body>
            <n.edit_header
Macro
Parameters: first_text, second_text
 first_text="[n.root_node
Binary
Namespace: NabbleNamespace
Parameters: do
.subject
Macro
Requires: node
/]" second_text="[t]Use Google Analytics[/t]" />
 
            <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.both
Binary
Namespace: BasicNamespace
Parameters: condition1, condition2
 condition1="[n.is_submitted_form
Macro
Requires: servlet
/]" condition2="[n.has_exception
Binary
Namespace: BasicNamespace
Parameters: for
 for='save-block'/]">
                <then>
                    <n.format_error
Macro
Parameters: message, prompt
.handle_exception
Binary
Namespace: NabbleNamespace
Parameters: for, do
. for="save-block">
                        <n.exception
Binary
Namespace: ExceptionNamespace
Parameters: name, do
. name="invalid_analytics_id">
                            <t>Enter a valid analytics account ID.</t>
                        </n.exception.>
                    </n.format_error.handle_exception.>
                </then>
            </n.if.both>
 
            <div style="margin:1.5em 0">
                <t>Here you can use Google Analytics to measure the success of your app.</t>
                <t>Enter below your analytics account ID and you will be able to track visits, visitors and other important statistics about your web traffic.</t>
            </div>
 
            <n.form
Macro
Requires: servlet
Parameters: macro, method, onsubmit, content
.>
                <t>Analytics Account ID:</t>
                <n.google_analytics_code_field
Macro
Parameters: do
.input
Macro
Requires: field
Parameters: size, maxlength, tabindex, type
 type="text" size="20" maxlength="20"/>
                <t>(e.g., UA-12345-0)</t>
                <div style="margin-top:1.5em">
                    <input type="submit" class="toolbar action-button" value="[t]Save Changes[/t]" />
                    <t>or</t> <a href="[n.root_node
Binary
Namespace: NabbleNamespace
Parameters: do
.url
Macro
Requires: node
Parameters: template, date, assignee, index_record, priority
/]"><t>Cancel</t></a>
                </div>
            </n.form.>
        </body>
    </n.html>
</macro>