Skip to content

Commit 4f0ab3f

Browse files
authored
Merge pull request #3443 from segmentio/Amp-edits
Analytics for AMP edits
2 parents 95edfc1 + 98fac08 commit 4f0ab3f

File tree

1 file changed

+20
-20
lines changed
  • src/connections/sources/catalog/libraries/mobile/amp

1 file changed

+20
-20
lines changed

src/connections/sources/catalog/libraries/mobile/amp/index.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ title: Analytics for AMP
33
redirect_from: '/connections/sources/catalog/libraries/server/amp/'
44
---
55

6-
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.
77
The component automatically collects default properties and sends a page view.
88

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.
1010

1111

12-
## Getting Started
12+
## Getting started
1313

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.
1515

1616
### 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"}:
1818

1919
```js
2020
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
2121
```
2222

23-
### Step 2: Include Segment Analytics
24-
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:
2525

2626
```html
2727
<body>
@@ -39,12 +39,12 @@ Within you `<body>` tags, include the following Segment analytics snippet:
3939
```
4040
Replace `WRITE_KEY` with the write key you obtain from the AMP Source you've set up within the Segment UI.
4141

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).
4343

4444

4545
## Page
4646

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.
4848

4949
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:
5050

@@ -65,7 +65,7 @@ A `page` call is included by default when you include Segment Analytics into you
6565

6666
The Track method (referred to as `click` in AMP) lets you record any actions your users perform.
6767

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:
6969

7070
```html
7171
<body>
@@ -95,7 +95,7 @@ In order to track these `click` events simply add a trigger with a `selector`, w
9595

9696
## Properties
9797

98-
### Default Properties
98+
### Default properties
9999

100100
A few properties are automatically collected with each page view and track call:
101101

@@ -112,7 +112,7 @@ A few properties are automatically collected with each page view and track call:
112112
}
113113
```
114114

115-
### Custom Properties
115+
### Custom properties
116116

117117
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>`:
118118

@@ -136,9 +136,9 @@ If you would like to collect additional, custom properties, include an `extraUrl
136136
</amp-analytics>
137137
```
138138

139-
### UTM Parameters
139+
### UTM parameters
140140

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:
142142

143143
```html
144144
<amp-analytics type="segment">
@@ -160,9 +160,9 @@ Our AMP Source doesn't automatically collect UTM parameters for you but you can
160160

161161
## AMP Linker
162162

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.
164164

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.
166166

167167
```
168168
<amp-analytics type="segment">
@@ -185,12 +185,12 @@ In order to enable this feature, you will need to include a `linkers` object set
185185
## Troubleshooting
186186

187187
### 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".
189189

190190
### 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`.
192192

193-
### How do I manager user identities client-side and server-side?
193+
### How do I manage user identities client-side and server-side?
194194
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.
195195

196196
```
@@ -204,7 +204,7 @@ This identity schema will allow you to join down funnel interaction with earlier
204204
### Why aren't all my IDs prefixed with an 'amp-'?
205205

206206
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).
208208

209209

210210
See a live <a href="https://segment-amp.firebaseapp.com">AMP with Segment analytics</a>

0 commit comments

Comments
 (0)