Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add managing user state docs #7433

Merged
merged 9 commits into from Feb 10, 2017
Merged

Conversation

rudygalfi
Copy link
Contributor

This PR will introduce a guide on managing non-authenticated user state in AMP.

Major sections are:

  • Explainer on how managing user state is complicated by AMP's multi-context model
  • Implementation guide for taking advantage of web and AMP features to enable coordinating state across contexts
  • Guidelines and best practices

@dknecht
Copy link
Contributor

dknecht commented Feb 8, 2017

Suggest that you change terminology in image from "google.com" to something more generic and use google.com as example.

The contents of this doc are discussed in much more detail in the new amp-managing-user-stage.md doc
@rudygalfi
Copy link
Contributor Author

ping @bpaduch @cramforce

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor fixes for style; reviewed text b4.

### Display contexts for AMP pages

You can think of AMP as a portable content format that enables content to be loaded fast anywhere. AMP documents can be displayed via three noteworthy contexts:

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table would look better if you specified width, the old-fashioned HTML way (sorry, no markdown).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

converted to tables


**Case #1: Initial visit.** Upon first landing on the non-AMP page, there will be no cookie. If you checked for the cookie before one was set, you’d see no values set in the cookie corresponding to the `uid`:

```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all your code blocks, please specify a language - html, hs, or text

Example:

```text
blah,blah
...

@@ -0,0 +1,444 @@
# Managing non-authenticated user state with AMP

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add TOC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


### Task 3: Process analytics pings from pages on the publisher origin

Because of the setup performed in Tasks 1 and 2, when someone accesses the AMP version (from any context) or the non-AMP version on the publisher origin the analytics ping will use the same identifier. By following the guidance in Task 2 to choose a Client ID "scope" that was the same name as the name of the cookie you used in Task 1, AMP reuses the same cookie.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reference to specific Tasks, please link to them - helps the user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


This is illustrated in the table below:

| An analytics ping coming from... | ... looks like this: |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table would look better if you used HTML and specified width so that the 1st column isn't so squished, and hard to read.

@rudygalfi
Copy link
Contributor Author

Addressed all comments from @bpaduch

@rudygalfi rudygalfi merged commit f38c6ee into master Feb 10, 2017
torch2424 pushed a commit to torch2424/amphtml that referenced this pull request Feb 14, 2017
* Add managing user state docs

* Adding image resources

* Delete placeholder for image folder

* Add amp-managing-user-state.md

* Delete cross-origin-tracking.md

The contents of this doc are discussed in much more detail in the new amp-managing-user-stage.md doc

* Change tables to HMTL, specify language of code blocks

* Fix orig_user_id and user_id that didn't get updated

* Added TOC; added some more code block type indicators

* Add links for tasks
@mrjoro mrjoro deleted the rudygalfi-managing-user-state-docs branch February 23, 2017 17:20
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
* Add managing user state docs

* Adding image resources

* Delete placeholder for image folder

* Add amp-managing-user-state.md

* Delete cross-origin-tracking.md

The contents of this doc are discussed in much more detail in the new amp-managing-user-stage.md doc

* Change tables to HMTL, specify language of code blocks

* Fix orig_user_id and user_id that didn't get updated

* Added TOC; added some more code block type indicators

* Add links for tasks

Through usage of features that require Client ID, AMP will do the “under the hood” work to generate and store client ID values and surface them to the features that require them. One of the principal features that can use AMP’s Client ID is [amp-analytics](https://www.ampproject.org/docs/reference/components/amp-analytics), which happens to be exactly what we’ll need to implement our analytics use case example.

On AMP pages, construct an analytics-analytics ping containing the Client ID:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rudygalfi what is analytics-analytics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be amp-analytics. Thanks - I'll fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants