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 a vendor filter to analytics-vendors.amp.html for easier testing. #9389

Merged
merged 7 commits into from May 23, 2017

Conversation

lannka
Copy link
Contributor

@lannka lannka commented May 17, 2017

No description provided.

var ads = file.match(new RegExp('<(amp-ad|amp-embed) [^>]*[\'"]'
+ req.query.type + '[\'"][^>]*>([\\s\\S]+?)<\/(amp-ad|amp-embed)>', 'gm'));
file = file.replace(
/<body>[\s\S]+<\/body>/m, '<body>' + ads.join('') + '</body>');
}

// Extract amp-ad for the given 'type' specified in URL query.
Copy link
Contributor

Choose a reason for hiding this comment

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

update comment.

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

1. "optout": if needed. We currently don't have a great opt-out system, so please reach out to help us design one that works well for you.
1. An example in the [examples/analytics-vendors.amp.html](../../examples/analytics-vendors.amp.html)
1. A line for your analytics service in the 'type' attribute section of the [amp-analytics](amp-analytics.md) usage reference.
1. Test the new example you put in [examples/analytics-vendors.amp.html](../../examples/analytics-vendors.amp.html) to ensure the hits from the example are working as expected. For example, the data needed is being collected and displayed in your analytics dashboard.
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: say something about type parameter for the example file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the dropdown UI is intuitive, isn't it? :-)

var ads = file.match(new RegExp('<(amp-ad|amp-embed) [^>]*[\'"]'
+ req.query.type + '[\'"][^>]*>([\\s\\S]+?)<\/(amp-ad|amp-embed)>', 'gm'));
file = file.replace(
/<body>[\s\S]+<\/body>/m, '<body>' + ads.join('') + '</body>');
}

// Extract amp-ad for the given 'type' specified in URL query.
if (req.path.indexOf('/examples/analytics-vendors.amp.html') == 0 && req.query.type) {
var analytics = file.match(new RegExp('<amp-analytics [^>]*[\'"]'
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: move the creation of regex out to a function?

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

<form action="analytics-vendors.amp.html" method="get" target="_top">
<label for="filter">Vendor filter</label>
<select id="filter" name="type">
<option>[Select a vendor]</option>
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not clear exactly why one needs to select a vendor. Maybe put it somewhere?

"Select a vendor to show config for that vendor." or something along these lines. I initially thought that selecting a type will allow you to run only that analytics type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

your initial thought is actually right

@lannka
Copy link
Contributor Author

lannka commented May 23, 2017

@avimehta PTAL

Copy link
Contributor

@avimehta avimehta left a comment

Choose a reason for hiding this comment

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

Thanks for helping with this cleanup!

@lannka lannka merged commit ffddf1b into ampproject:master May 23, 2017
@lannka lannka deleted the improve-analytics-vendors-example branch May 23, 2017 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants