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
The [Segment AMP](https://www.ampproject.org/docs/reference/components/amp-analytics#segment) component makes it easy to send your data to lots of tools without having to learn, test or implement a new AMP component every time.
6
+
The [Segment AMP](https://www.ampproject.org/docs/reference/components/amp-analytics#segment){:target="_blank"} component makes it easy to send your data to lots of tools without having to learn, test or implement a new AMP component every time.
7
7
The component automatically collects default properties and sends a page view.
8
8
9
-
**NOTE:** Since our AMP source sends data directly to our servers, only destinations that support [cloud-mode](/docs/connections/destinations/#connection-modes) are compatible with AMP.
9
+
**NOTE:** Since the AMP source sends data directly to Segment's servers, only destinations that support [cloud-mode](/docs/connections/destinations/#connection-modes) are compatible with AMP.
10
10
11
11
12
-
## Getting Started
12
+
## Getting started
13
13
14
-
If you're new to [AMP](https://www.ampproject.org), go through their excellent [Quickstart](https://www.ampproject.org/docs/get_started/create_page.html). Once you're setup, follow the steps below to implement Segment.
14
+
If you're new to [AMP](https://www.ampproject.org){:target="_blank"}, go through AMP's excellent [Quickstart](https://www.ampproject.org/docs/get_started/create_page.html){:target="_blank"}. Once you're setup, follow the steps below to implement Segment.
15
15
16
16
### Step 1: Include AMP component
17
-
Before the closing `</head>` tag, include the [`amp-analytics` component](https://www.ampproject.org/docs/reference/components/amp-analytics):
17
+
Before the closing `</head>` tag, include the [`amp-analytics` component](https://www.ampproject.org/docs/reference/components/amp-analytics){:target="_blank"}:
Within you`<body>` tags, include the following Segment analytics snippet:
23
+
### Step 2: Include Segment analytics
24
+
Within your`<body>` tags, include the following Segment analytics snippet:
25
25
26
26
```html
27
27
<body>
@@ -39,12 +39,12 @@ Within you `<body>` tags, include the following Segment analytics snippet:
39
39
```
40
40
Replace `WRITE_KEY` with the write key you obtain from the AMP Source you've set up within the Segment UI.
41
41
42
-
By default, the snippet will automatically fire a page event which you can read more about [here](https://segment.com/docs/connections/sources/catalog/libraries/mobile/amp/#page).
42
+
By default, the snippet will automatically fire a page event which you can read more about [here](/docs/connections/sources/catalog/libraries/mobile/amp/#page).
43
43
44
44
45
45
## Page
46
46
47
-
The Page method lets you record page views on your website, along with your choice of [custom properties](https://segment.com/docs/connections/sources/catalog/libraries/mobile/amp/#getting-started) about the page being viewed.
47
+
The Page method lets you record page views on your website, along with your choice of [custom properties](/docs/connections/sources/catalog/libraries/mobile/amp/#getting-started) about the page being viewed.
48
48
49
49
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:
50
50
@@ -65,7 +65,7 @@ A `page` call is included by default when you include Segment Analytics into you
65
65
66
66
The Track method (referred to as `click` in AMP) lets you record any actions your users perform.
67
67
68
-
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), which will send that event once the user clicks:
68
+
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:
69
69
70
70
```html
71
71
<body>
@@ -95,7 +95,7 @@ In order to track these `click` events simply add a trigger with a `selector`, w
95
95
96
96
## Properties
97
97
98
-
### Default Properties
98
+
### Default properties
99
99
100
100
A few properties are automatically collected with each page view and track call:
101
101
@@ -112,7 +112,7 @@ A few properties are automatically collected with each page view and track call:
112
112
}
113
113
```
114
114
115
-
### Custom Properties
115
+
### Custom properties
116
116
117
117
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>`:
118
118
@@ -136,9 +136,9 @@ If you would like to collect additional, custom properties, include an `extraUrl
136
136
</amp-analytics>
137
137
```
138
138
139
-
### UTM Parameters
139
+
### UTM parameters
140
140
141
-
Our AMP Source doesn't automatically collect UTM parameters for you but you can define these explictly as a property. An example of this is shown below:
141
+
Segment's AMP Source doesn't collect UTM parameters for you but you can define them as a property. An example of this is shown below:
142
142
143
143
```html
144
144
<amp-analyticstype="segment">
@@ -160,9 +160,9 @@ Our AMP Source doesn't automatically collect UTM parameters for you but you can
160
160
161
161
## AMP Linker
162
162
163
-
In order to maintain a merged session for a user navigating from an AMP page served from AMP cache to AMP pages hosted on your domain, you will need to use the [AMP Linker](https://amp.dev/documentation/examples/advertising-analytics/joining_analytics_sessions/) feature. It works by decorating outgoing links from AMP cache with params such as AMP Client ID in a URL parameter and gets written into a first-party cookie.
163
+
In order to maintain a merged session for a user navigating from an AMP page served from AMP cache to AMP pages hosted on your domain, you will need to use the [AMP Linker](https://amp.dev/documentation/examples/advertising-analytics/joining_analytics_sessions/){:target="_blank"} feature. It works by decorating outgoing links from AMP cache with params such as AMP Client ID in a URL parameter and gets written into a first-party cookie.
164
164
165
-
In order to enable this feature, you will need to include a `linkers` object set to `true` within your configuration.
165
+
In order to enable this feature, you'll need to include a `linkers` object set to `true` within your configuration.
166
166
167
167
```
168
168
<amp-analytics type="segment">
@@ -185,12 +185,12 @@ In order to enable this feature, you will need to include a `linkers` object set
185
185
## Troubleshooting
186
186
187
187
### Can I use client-side Destinations?
188
-
No. All AMP data is sent from Google's servers to our server-side API and subsequently only onto our server-side Destinations. You will only be able to use our server-side destinations and their relevant setting. For example, for Google Analytics, use the "Server-side Tracking ID".
188
+
No. All AMP data is sent from Google's servers to Segment's server-side API and subsequently only onto Segment's server-side destinations. You'll only be able to use Segment's server-side destinations and their relevant settings. For example, for Google Analytics, use the "Server-side Tracking ID".
189
189
190
190
### How do I identify users?
191
-
Because AMP is static, it doesn't provide many options for persistently identifying users. AMP provides a basic cookie mechanism called an AMP Client ID which is a uniquely generated cookie for every unique end user's AMP session. Depending on Google's caching settings, you may receive multiple AMP Client IDs for the same user. Segment will [capture](https://github.com/ampproject/amphtml/blob/b8abe2137f1a50ca6173a258fced64e41a46c763/extensions/amp-analytics/0.1/vendors.js#L1629-L1659) this AMP Client ID as an `anonymous_id` and it will be of this format: `amp-REDmCPH4F0QX44kCFomrcA`.
191
+
Because AMP is static, it doesn't provide many options for persistently identifying users. AMP provides a basic cookie mechanism called an AMP Client ID which is a uniquely generated cookie for every unique end user's AMP session. Depending on Google's caching settings, you may receive multiple AMP Client IDs for the same user. Segment will [capture](https://github.com/ampproject/amphtml/blob/b8abe2137f1a50ca6173a258fced64e41a46c763/extensions/amp-analytics/0.1/vendors.js#L1629-L1659){:target="_blank"} this AMP Client ID as an `anonymous_id` and it will be of this format: `amp-REDmCPH4F0QX44kCFomrcA`.
192
192
193
-
### How do I manager user identities client-side and server-side?
193
+
### How do I manage user identities client-side and server-side?
194
194
There is no user identity management client-side with AMP, so to join user sessions together you'll need to capture the AMP Client ID on your server-side and join it with your `user_id` in your warehouse.
195
195
196
196
```
@@ -204,7 +204,7 @@ This identity schema will allow you to join down funnel interaction with earlier
204
204
### Why aren't all my IDs prefixed with an 'amp-'?
205
205
206
206
All AMP events won't consistently have an 'amp-' prefixed ID as this is only included in the event that the AMP page is directly visited on your domain.
207
-
For further details refer to the various `Client ID` scenarios in relation to AMP pages [here](https://developers.google.com/analytics/devguides/collection/amp-analytics/client-id) (we can only guarantee that if the 3rd scenario happens, the AMP ID will get generated and picked up).
207
+
For further details refer to the various `Client ID` scenarios in relation to AMP pages [here](https://developers.google.com/analytics/devguides/collection/amp-analytics/client-id){:target="_blank"} (Segment can only guarantee that if the third scenario happens, the AMP ID will get generated and picked up).
208
208
209
209
210
210
See a live <ahref="https://segment-amp.firebaseapp.com">AMP with Segment analytics</a>
0 commit comments