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
Conversation
36d1076
to
7b00ae3
Compare
73b169c
to
83cd52a
Compare
83cd52a
to
0a6e561
Compare
@cramforce PTAL |
@@ -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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setHeader is not needed.
0a6e561
to
d56fa43
Compare
* outgoingFragment: string | ||
* }} | ||
*/ | ||
let ShareTrackingPostResponseDef; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only used once. Inline?
73800ae
to
e63e593
Compare
} | ||
|
||
/** @override */ | ||
createdCallback() { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
40ebfbd
to
5d91985
Compare
Adressed all the comments in latest commit. PTAL |
} | ||
|
||
/** @override */ | ||
isLayoutSupported(layout) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
LGTM with one request |
|
||
/** @private @const {string} */ | ||
const TAG = 'amp-share-tracking'; | ||
|
||
class AmpShareTracking extends AMP.BaseElement { | ||
export class AmpShareTracking extends AMP.BaseElement { |
There was a problem hiding this comment.
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
d9b9c20
to
d6df2e6
Compare
PTAL |
|
||
/** | ||
* Get an outgoing share-tracking fragment | ||
* @return {!Promise<string|undefined>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<string>
Nitpicks, LGTM. |
d6df2e6
to
af2ebc4
Compare
user.error(TAG, 'The response from [' + vendorUrl + '] does not ' + | ||
'have a fragment value.'); | ||
return ''; | ||
}).catch(error => { |
There was a problem hiding this comment.
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.
LGTM. |
…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
#3135
AmpShareTracking
will get incoming and outgoing share tracking identifier