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

Make share-tracking extension to get incoming/outcoming fragments #4019

Merged
merged 10 commits into from Jul 28, 2016

Conversation

muxin
Copy link
Contributor

@muxin muxin commented Jul 11, 2016

#3135

  • AmpShareTracking will get incoming and outgoing share tracking identifier
  • Get incoming fragment: from url hash directly or ask viewer to get it
  • Get outgoing fragment: from url endpoint provided by vendor or generate randomly

@muxin muxin force-pushed the share-tracking-service branch 2 times, most recently from 36d1076 to 7b00ae3 Compare July 11, 2016 22:54
@muxin muxin force-pushed the share-tracking-service branch 4 times, most recently from 73b169c to 83cd52a Compare July 18, 2016 21:19
@muxin muxin changed the title [WIP] Create share-tracking service to get incoming/outcoming fragment Create share-tracking service to get incoming/outcoming fragment Jul 18, 2016
@muxin
Copy link
Contributor Author

muxin commented Jul 18, 2016

@cramforce PTAL
I'm still not sure how we should generate the random encoded id. How long would it be? Shall we make it configurable? Any idea?
[Update]: After discussion, we could use 40 bit binary to generate base 64 encoded id.

@@ -115,6 +115,13 @@ app.use('/form/echo-json/post', function(req, res) {
});
});

app.use('/share-tracking/get-outgoing-fragment', function(req, res) {
res.setHeader('Content-Type', 'application/json');
Copy link
Contributor

Choose a reason for hiding this comment

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

setHeader is not needed.

* outgoingFragment: string
* }}
*/
let ShareTrackingPostResponseDef;
Copy link
Member

Choose a reason for hiding this comment

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

Only used once. Inline?

@muxin muxin force-pushed the share-tracking-service branch 2 times, most recently from 73800ae to e63e593 Compare July 19, 2016 01:37
}

/** @override */
createdCallback() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to put this in #createdCallback instead of #buildCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure about this. I saw AmpUserNotification did this.
@dvoytenko WDYT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move everything in buildCallback

@muxin muxin force-pushed the share-tracking-service branch 2 times, most recently from 40ebfbd to 5d91985 Compare July 21, 2016 18:48
@muxin muxin changed the title Create share-tracking service to get incoming/outcoming fragment Make share-tracking extension to get incoming/outcoming fragments Jul 21, 2016
@muxin
Copy link
Contributor Author

muxin commented Jul 27, 2016

Adressed all the comments in latest commit. PTAL

}

/** @override */
isLayoutSupported(layout) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind copying this to amp-experiment.js as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created a separate PR since this has nothing to do with share-tracking.

@dvoytenko
Copy link
Contributor

LGTM with one request


/** @private @const {string} */
const TAG = 'amp-share-tracking';

class AmpShareTracking extends AMP.BaseElement {
export class AmpShareTracking extends AMP.BaseElement {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please mark this as @visibleForTesting

@muxin
Copy link
Contributor Author

muxin commented Jul 27, 2016

PTAL


/**
* Get an outgoing share-tracking fragment
* @return {!Promise<string|undefined>}
Copy link
Contributor

Choose a reason for hiding this comment

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

<string>

@jridgewell
Copy link
Contributor

Nitpicks, LGTM.

user.error(TAG, 'The response from [' + vendorUrl + '] does not ' +
'have a fragment value.');
return '';
}).catch(error => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: This callback can be the second param to #then above.

@jridgewell
Copy link
Contributor

LGTM.

@muxin muxin merged commit 0ed332f into ampproject:master Jul 28, 2016
@muxin muxin deleted the share-tracking-service branch July 28, 2016 21:14
ariangibson pushed a commit to Mixpo/amphtml that referenced this pull request Sep 7, 2016
…pproject#4019)

* `AmpShareTracking` will get incoming and outgoing share tracking identifier
* Get incoming fragment: from url hash directly or ask viewer to get it
* Get outgoing fragment: from url endpoint provided by vendor or generate randomly
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

7 participants