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 support for Parsely analytics #1595

Merged
merged 1 commit into from
Feb 11, 2016
Merged

Conversation

msukmanowsky
Copy link
Contributor

See #1500 for additional information. This PR adds vendor configuration support for Parse.ly analytics.

Outstanding issues are the additional configuration variables we're requesting and the open discussions on client-side sessionization and engaged time implementations.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@msukmanowsky
Copy link
Contributor Author

@amontalenti has signed the CLA.

@cramforce
Copy link
Member

CC @rudygalfi

@rudygalfi
Copy link
Contributor

@msukmanowsky I think the CLA bot will require you to say "I signed it!"

cc @jmadler

@@ -41,6 +41,11 @@ export const ANALYTICS_CONFIG = {
'scrollHeight': 'SCROLL_HEIGHT',
'screenWidth': 'SCREEN_WIDTH',
'screenHeight': 'SCREEN_HEIGHT'
// TODO: Requested by Parse.ly
// screenAvailWidth (screen.availWidth)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can remove the first three items here. @rudygalfi has opened #1503.

cc @cramforce for the last item. I am not sure if/how we'll do the session stuff. I think it requires some kind of storage on the client side.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: #1668 adds the these three items. Not in yet, but close.

Copy link
Contributor

Choose a reason for hiding this comment

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

These vars should be available now.

@avimehta
Copy link
Contributor

Forgot to mention:

Also, if you guys would like, you can add an example of parsely to examples/analytics.amp.html

@rudygalfi
Copy link
Contributor

@msukmanowsky Three of the variables you requested should make it in soon, so you may want to update this once those are in.

@rudygalfi
Copy link
Contributor

cc @andreban

@avimehta
Copy link
Contributor

avimehta commented Feb 3, 2016

Any updates on this? Please sync with HEAD and rebase. I think we are almost there.

@rudygalfi
Copy link
Contributor

@msukmanowsky I think this is close. Could you take a fresh look at the comments, resolve and rebase?

@msukmanowsky
Copy link
Contributor Author

Apologies for the wait, going to have a look today @rudygalfi.

@msukmanowsky
Copy link
Contributor Author

@googlebot I signed it!

@@ -60,6 +60,7 @@ when the document is first loaded, and each time an `<a>` tag is clicked:
## <a name="attributes"></a>Attributes

- `type` This optional attribute can be specified to use one of the built-in analytics providers. Currently supported values for type are:
- `parsely`: Adds support for Parsely. Configuration details can be found at [parsely.com/docs](http://parsely.com/docs/integration/partners/google-amp.html).
Copy link
Contributor

Choose a reason for hiding this comment

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

This list should be sorted alphabetically.

@avimehta
Copy link
Contributor

avimehta commented Feb 8, 2016

Also, do you mind squashing the commits into a single commit to prepare for merging?

Thanks!

@msukmanowsky
Copy link
Contributor Author

@avimehta will do on squashing.

Quick question for you and clientId usage. As far as I understand from https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md, if an AMP page is served off the publisher's site and not the AMP CDN, it will effectively use the value of whatever is stored in the cookie amp-${cid scope}$.

Parse.ly stores a visitor ID in a _parsely_visitor cookie on publisher web sites whose value is currently a JSON-encoded string like the following:

'"{"id":"0765d266-80eb-45b3-bd50-81db037498a0","session_count":1,"last_session_ts":1454967564476}'

The id attribute of that JSON object contains the current visitor ID assigned by Parse.ly upon a visitor's first visit. Is it possible for clientId to fall back on this JSON attribute instead of creating a new cookie like amp-parsely which would invariably lead to unique visitor duplication?

Apologies as I may have misunderstood something with respect to CLIENT_ID usage.

@rudygalfi
Copy link
Contributor

Publisher site case: cid-scope resolves to the cookie name that's used. It shouldn't have an "amp-" prefix if you don't specify it that way. In other words cid-scope=_parsely_visitor should read cookie _parsely_visitor. If there is no cookie called that, then AMP will set one as “amp-” followed by base64 encoded random string.

AMP CDN case: AMP manages get/set of CID and will generate one. This CID will be unique per a combination of publisher origin (e.g. the nytimes.com part of cdn.ampproject.org/c/nytimes.com/...) and the cid-scope.

You asked:

Is it possible for clientId to fall back on this JSON attribute instead of creating a new cookie like amp-parsely which would invariably lead to unique visitor duplication?

Would there be any issue with transmitting the whole JSON back and extracting the ID server-side?

@msukmanowsky
Copy link
Contributor Author

@rudygalfi perfect, thanks for the explanation. We should be able to work just fine with that.

@rudygalfi
Copy link
Contributor

Meant to cc @cramforce on the above to get his take, but happy to hear it should work for you.

@cramforce can you read over #1595 (comment) and let us know if it seems reasonable to you or if you have additional suggestions?

@cramforce
Copy link
Member

That is exactly right.

@msukmanowsky
Copy link
Contributor Author

Regarding testing, I've created a local build with gulp clean build extensions serve but viewing http://localhost:8000/examples.build/analytics.amp.html#development=1 doesn't show any pixel requests being sent to srv.pixel.parsely.com on load which is expected given the trigger we have in place.

Anything we missed in our integration?

@cramforce
Copy link
Member

Just running gulp should be enough. It looks good from a quick glance.

@msukmanowsky
Copy link
Contributor Author

@cramforce you're seeing pixel requests to srv.pixel.parsely.com? I'm still not seeing anything here.

@cramforce
Copy link
Member

I wasn't checking your PR directly yet :) Just looked at the source.

@msukmanowsky
Copy link
Contributor Author

Gotcha. I'm not seeing any requests for chartbeat either fwiw. Only Google Analytics and comScore seem to be working.

@msukmanowsky
Copy link
Contributor Author

@rudygalfi @cramforce I think this is ready to go but feel a little uneasy about not being able to test/see actual pixels firing on that aforementioned example page.

'parsely': {
'requests': {
'host': 'https://srv.pixel.parsely.com',
'basePrefix': '${host}$/plogger/?' +
Copy link
Member

Choose a reason for hiding this comment

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

There is an extra $ after ${host}

@cramforce
Copy link
Member

I checked out your PR and discovered you had a typo in the URL. See above. With that fixed it looks good. Chartbeat also appears to work fine from here.

@msukmanowsky
Copy link
Contributor Author

Thanks @cramforce, fixed the string interpolation issues (there were more than the one, dumb on my part). I can now see the chartbeat pixel firing, but still not ours on http://localhost:8000/examples.build/analytics.amp.html.

'xhrpost': false,
'image': true
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove this empty line?

@msukmanowsky
Copy link
Contributor Author

Thanks @avimehta. Turns out I didn't have the Chrome extension installed and so requests for AMP JS files weren't being redirected to localhost.

Having a final look and will then ping you.

@msukmanowsky
Copy link
Contributor Author

Alright @avimehta @rudygalfi @cramforce, we're ready to go here, apologies for the delays!

@rudygalfi
Copy link
Contributor

👍 LGTM

@avimehta
Copy link
Contributor

@msukmanowsky there seems to be a lint error? Can you fix that? @rudygalfi will merge as soon as that is done. Thanks for the patience so far!

lgtm otherwise.

@msukmanowsky
Copy link
Contributor Author

@avimehta good to go.

rudygalfi added a commit that referenced this pull request Feb 11, 2016
Add support for Parsely analytics
@rudygalfi rudygalfi merged commit df0a119 into ampproject:master Feb 11, 2016
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.

5 participants