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

Fix amp-analytics related bugs. #1547

Merged
merged 1 commit into from
Jan 25, 2016
Merged

Conversation

avimehta
Copy link
Contributor

  • Added a default value for eventValue. "0" was used instead of 0 because amp-analytics does not fill in falsey values.
  • Have a more customizable documentLocation for GA. This way, if a person wants to send both canonicalUrl and ampdocUrl in a hit, they can.
  • Renamed socialActionTarget to socialTarget

Fixes #1494
Fixes #1491

cc: @btownsend

@cramforce cramforce changed the title Fix for #1494 and #1491 Fix amp-analytics related bugs. Jan 24, 2016
'requests': {
'host': 'https://www.google-analytics.com',
'basePrefix': 'v=1&_v=a0&aip=true&_s=${hitCount}&dl=${canonicalUrl}&' +
'basePrefix': 'v=1&_v=a0&aip=true&_s=${hitCount}&' +
Copy link
Member

Choose a reason for hiding this comment

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

Just out of curiosity: Would you not want to send the referrer somewhere here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching that. Added document referrer and also added a comment about vars that would be nice to have...

@cramforce
Copy link
Member

Tuned PR title and description a bit.

@avimehta
Copy link
Contributor Author

ptal.

Have a more customizable documentLocation for GA. This way, if a person wants to send both canonicalUrl and ampdocUrl in a hit, they can.
}
// TODO(btownsend, #871): Add a generic hit format to make custom analytics
// easier.
},

'googleanalytics': {
'vars': {
'eventValue': "0",
'documentLocation': 'AMPDOC_URL'
Copy link
Contributor

Choose a reason for hiding this comment

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

curious: why not dl=${ampdocUrl} below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I do that, people will have to override the ampdocUrl property to set a different value for dl. That looks and feel counter-intuitive. SInce this is a common thing many people do, I opted for this solution instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 makes sense, thanks

@cramforce
Copy link
Member

LGTM

cramforce added a commit that referenced this pull request Jan 25, 2016
Fix amp-analytics related bugs.
@cramforce cramforce merged commit 23fb9bb into ampproject:master Jan 25, 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.

3 participants