You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/mobile/amp/index.md
+14-15Lines changed: 14 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,14 @@ If you're new to [AMP](https://www.ampproject.org){:target="_blank"}, go through
17
17
### Step 1: Include AMP component
18
18
Before the closing `</head>` tag, include the [`amp-analytics` component](https://www.ampproject.org/docs/reference/components/amp-analytics){:target="_blank"}:
Within your `<body>` tags, include the following Segment analytics snippet:
26
26
27
-
```html
27
+
```html
28
28
<body>
29
29
<amp-analyticstype="segment">
30
30
<scripttype="application/json">
@@ -37,12 +37,12 @@ Within your `<body>` tags, include the following Segment analytics snippet:
37
37
</script>
38
38
</amp-analytics>
39
39
</body>
40
-
```
40
+
```
41
41
Replace `WRITE_KEY` with the write key you obtain from the AMP Source you've set up within the Segment UI.
42
42
43
43
For sources in [EU workspaces](/docs/guides/regional-segment/), use the following snippet:
44
44
45
-
```html
45
+
```html
46
46
<amp-analyticstype="segment">
47
47
<scripttype="application/json">
48
48
{
@@ -55,7 +55,7 @@ For sources in [EU workspaces](/docs/guides/regional-segment/), use the followin
55
55
}
56
56
</script>
57
57
</amp-analytics>
58
-
```
58
+
```
59
59
60
60
By default, the snippet will automatically fire a page event which you can read more about [in the Page section of this documentation](/docs/connections/sources/catalog/libraries/mobile/amp/#page).
61
61
@@ -66,7 +66,7 @@ The Page method lets you record page views on your website, along with your choi
66
66
67
67
A `page` call is included by default when you include Segment Analytics into your code with the ability to customize the `name` of your page:
68
68
69
-
```html
69
+
```html
70
70
<amp-analyticstype="segment">
71
71
<scripttype="application/json">
72
72
{
@@ -77,15 +77,15 @@ A `page` call is included by default when you include Segment Analytics into you
77
77
}
78
78
</script>
79
79
</amp-analytics>
80
-
```
80
+
```
81
81
82
82
## Track
83
83
84
84
The Track method (referred to as `click` in AMP) lets you record any actions your users perform.
85
85
86
86
In order to track these `click` events simply add a trigger with a `selector`, which behaves the same way as [CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp){:target="_blank"}, which will send that event once the user clicks:
87
87
88
-
```html
88
+
```html
89
89
<body>
90
90
<amp-analyticstype="segment">
91
91
<scripttype="application/json">
@@ -109,15 +109,15 @@ In order to track these `click` events simply add a trigger with a `selector`, w
A few properties are automatically collected with each page view and track call:
119
119
120
-
```json
120
+
```json
121
121
{
122
122
"anonymousId": "amp-<unique-id>",
123
123
"context.locale": "en-US",
@@ -128,13 +128,13 @@ A few properties are automatically collected with each page view and track call:
128
128
"context.screen.width": 600,
129
129
"context.screen.height": 800
130
130
}
131
-
```
131
+
```
132
132
133
133
### Custom properties
134
134
135
135
If you would like to collect additional, custom properties, include an `extraUrlParams` object. All properties you'd like to include must follow the format of `properties.<property_name>`:
136
136
137
-
```html
137
+
```html
138
138
<amp-analyticstype="segment">
139
139
<scripttype="application/json">
140
140
{
@@ -152,7 +152,7 @@ If you would like to collect additional, custom properties, include an `extraUrl
152
152
}
153
153
</script>
154
154
</amp-analytics>
155
-
```
155
+
```
156
156
157
157
### UTM parameters
158
158
@@ -226,4 +226,3 @@ For further details refer to the various `Client ID` scenarios in relation to AM
226
226
<!-- TODO: the product linked above was deprecated, need to find a replacement or hide this page --->
227
227
228
228
See a live <ahref="https://segment-amp.firebaseapp.com">AMP with Segment analytics</a>
0 commit comments