Added element-level overrides for variables for amp-analytics #4072

Merged
merged 8 commits into from Aug 8, 2016

Projects

None yet

7 participants

@rajkumarsrk
Contributor

Adding element level overrides for amp-analytics variable based on the discussion that we had
#1298 (comment).
Please review it and let me know your feedback

@avimehta @cramforce Could you suggest best place where I can update the documentation for this.
I was thinking to add it here
https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/amp-analytics.md#vars. But will wait for you inputs

@googlebot

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.
@rudygalfi
Contributor

This is specific to click trigger, so documentation within https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/amp-analytics.md#click-trigger-on-click would make the most sense.

I was wondering if it makes any sense at all to broaden this capability to other trigger types? I guess specifically visible now that it also has a selector attribute under visibilitySpec? cc @avimehta for feedback

https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/amp-analytics.md#vars

@avimehta avimehta was assigned by rudygalfi Jul 14, 2016
@avimehta
Collaborator

@rudygalfi If you have seen requests for data-vars on visible event, we can add them there as well. I have not come across such requests yet.

@rajkumarsrk Will look at the PR soon. You should mention the presence of these variables in https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/amp-analytics.md#click-trigger-on-click but give details of how to use these variables in interaction section of https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/analytics-vars.md. I do something similar for scroll triggers.

@rajkumarsrk
Contributor

@avimehta @rudygalfi . Sure, I will update the documentation

@rudygalfi
Contributor

I don't believe I've seen requests. My proposal was purely a hypothetical need and can be ignored for v1 so we just focus on click.

@avimehta
Collaborator

@rudygalfi actually, If you think it makes sense, let's do it in this PR. I am happy with whatever makes more sense to you.

@rudygalfi
Contributor

I think it makes sense. If it's not much additional work, I'd encourage adding it (and corresponding doc updates).

@senthilp

@rudygalfi we will look into it and update the PR with analysis for other trigger types. If it is simple enough we can accommodate it in this PR itself.

@rajkumarsrk
Contributor

@avimehta Is the selector inside the "visible" eventType has to a sibling property to on eventType.

Currently we have it as

"triggers": {
  "defaultPageview": {
    "on": "visible",
    "request": "pageview",
    "visibilitySpec": {
      "selector": "#anim-id",
      "visiblePercentageMin": 20,
      "totalTimeMin": 500,
      "continuousTimeMin": 200
    }
  }
}

having the following would resemble the click trigger types

"triggers": {
  "defaultPageview": {
    "on": "visible",
     "selector": "#anim-id",
    "request": "pageview",
    "visibilitySpec": {
      "visiblePercentageMin": 20,
      "totalTimeMin": 500,
      "continuousTimeMin": 200
    }
  }
}

By this way it would resemble the click eventType format where on, selector, request would be siblings

"links": {
        "on": "click",
        "selector": "#test1",
        "request": "click",
        "vars": {
          "label": "clickChapter::clickLabel",
          "level2Click": "12",
          "type": "a"
        }
      }

The reason for this question is, I am planning to pass the parsed values of data-attributes from the element level as a sibling to selector on config from createVisibilityListener_ on instrumentation

@avimehta avimehta commented on an outdated diff Jul 15, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -276,22 +276,45 @@ export class InstrumentationService {
}
/**
+ * @param {!Element} el
+ * @private
+ * @return {Object}
+ */
+ extractAnalyticsVariables_(el) {
+ const dataSet = el.dataset;
+ const vars = 'vars';
@avimehta
avimehta Jul 15, 2016 edited Collaborator

Move this to top of the file with other contants?

@avimehta avimehta commented on an outdated diff Jul 15, 2016
extensions/amp-analytics/0.1/instrumentation.js
// First do the cheap lookups.
- if (selector === '*' || this.matchesSelector_(e.target, selector)) {
- listener(new AnalyticsEvent(AnalyticsEventType.CLICK));
+ if (selector === '*' || this.matchesSelector_(el, selector)) {
+ // See https://github.com/ampproject/amphtml/issues/1298
@avimehta
avimehta Jul 15, 2016 edited Collaborator

you don't need this comment. We can find the details using blame history of this line.

Same below.

@avimehta avimehta and 1 other commented on an outdated diff Jul 15, 2016
extensions/amp-analytics/0.1/instrumentation.js
* @param {!Function} listener
* @param {string} selector
* @private
*/
createSelectiveListener_(listener, selector) {
return e => {
+ let el = e.target;
+ let dataSet = null;
@avimehta
avimehta Jul 15, 2016 Collaborator

maybe call this analyticsVariables or just variables?

@rajkumarsrk
rajkumarsrk Jul 15, 2016 Contributor

Yup. analyticsVariables will best fit for this

@avimehta
Collaborator

looks good so far.

@cramforce we talked about moving the selector one level up so that click and visible have the same place to specify selector. How do we go about doing a breaking change? Should we put a deprecation warning in the old format and start accepting the new format?

@cramforce
Member

It'll be tough to ever get rid of the old way (without bumping the amp-analytics version, which we would not for such a small thing), but we can definitely warn and keep supporting both.

@rajkumarsrk
Contributor

@avimehta Thanks for reviewing the changes. I will update this PR with review changes and adding support for the element level overrides for "visible" event.

@rajkumarsrk
Contributor

@avimehta & @cramforce Is it expected that the selector for visible event is always an Id ?

"triggers": {
  "defaultPageview": {
    "on": "visible",
    "request": "pageview",
    "visibilitySpec": {
      "selector": "#anim-id",
      "visiblePercentageMin": 20,
      "totalTimeMin": 500,
      "continuousTimeMin": 200
    }
  }
}

https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/0.1/visibility-impl.js#L241

@rudygalfi
Contributor

@rajkumarsrk I think it can also be a class name, e.g. .foo, but @avimehta should confirm.

@rajkumarsrk
Contributor

Got the answer for this from console "Visibility spec requires an id selector"

@rajkumarsrk
Contributor

@rudygalfi Thanks Rudy. Looks like we support only id only

@avimehta
Collaborator

@rajkumarsrk yes. We might want to add support for other elements formats at a later point but for now it is just ids.

@avimehta avimehta and 1 other commented on an outdated diff Jul 20, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -276,29 +284,50 @@ export class InstrumentationService {
}
/**
+ * @param {!Element} el
+ * @private
+ * @return {Object}
+ */
+ extractAnalyticsVariables_(el) {
+ const dataSet = el.dataset;
+ const analyticsVariables = {};
+ for (const dataKey in dataSet) {
+ if (dataKey.indexOf(vars) === 0) {
+ const variableName = dataKey.toLowerCase().replace(vars,'');
@avimehta
avimehta Jul 20, 2016 Collaborator

I think the latest example brings up an issue with this line. Vars have been case sensitive till now. If we lowercase the key, the casing gets lost. Can we avoid doing toLowerCase?

@rajkumarsrk
rajkumarsrk Jul 20, 2016 Contributor

Update this to follow the same format of naming convention that is followed for other variables (camelCase) as in domain=${canonicalHost}&path=${canonicalPath}

data-vars-sub-title="Example sub title" will resolve to

{
"varsSubTitle": "Example sub title"
} 

Which in turn is resolved to

{
"subTitle": "Example sub title"
} 
@avimehta avimehta and 1 other commented on an outdated diff Jul 20, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -28,6 +28,7 @@ const DEFAULT_MAX_TIMER_LENGTH_SECONDS_ = 7200;
const SCROLL_PRECISION_PERCENT = 5;
const VAR_H_SCROLL_BOUNDARY = 'horizontalScrollBoundary';
const VAR_V_SCROLL_BOUNDARY = 'verticalScrollBoundary';
+const vars = 'vars';
@avimehta
avimehta Jul 20, 2016 Collaborator

please make the name caps.

@rajkumarsrk
rajkumarsrk Jul 20, 2016 Contributor

Update this to name caps

@avimehta avimehta and 1 other commented on an outdated diff Jul 20, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -212,14 +213,21 @@ export class InstrumentationService {
* @private
*/
createVisibilityListener_(callback, config) {
- if (config['visibilitySpec']) {
+ const spec = config['visibilitySpec'];
+ const selector = config['selector'] || (spec && spec['selector']);
+ const analyticsVariables = config[vars] || {};
@avimehta
avimehta Jul 20, 2016 Collaborator

i don't understand this line. why are we reading from config[vars]? is some value expected to be there?

@rajkumarsrk
rajkumarsrk Jul 20, 2016 edited Contributor

By this we can have all the config level vars merged with element level variable overrides. This is similar to the tracking for 'click' event

@avimehta
avimehta Jul 21, 2016 Collaborator

but we don't do that for click event. In click event, the config level variables are merged with dataset variables in amp-analytics.js.

I think what you want to do is merge the analyticsVariables var with vars before Line 231.

@avimehta avimehta and 1 other commented on an outdated diff Jul 20, 2016
extensions/amp-analytics/0.1/instrumentation.js
if (!isVisibilitySpecValid(config)) {
return;
}
+ const el = this.win_.document.getElementById(selector
@avimehta
avimehta Jul 20, 2016 Collaborator

this and following three lines can be moved inside the callback passed into the listenOnce call below(#L231).

@rajkumarsrk
rajkumarsrk Jul 20, 2016 edited Contributor

I had the same feeling that we are doing the DOM reference in 2 place, one in instrumentation.js and other on visibility-impl.js. But when you check the implementation done for the 'click' event we have the element level overrides extracted on the createSelectiveListener_. And we have access to extractAnalyticsVariables_ inside instrumentation.js and not on visibility-impl.js. Let me know your thoughts on this

@avimehta
avimehta Jul 21, 2016 Collaborator

What I mean is that you can do this just before Line 231. The difference is that in one case, the variables are extracted during config registeration while in the other case, the variables are extracted when the trigger fires.

@avimehta avimehta and 1 other commented on an outdated diff Jul 20, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -212,14 +213,21 @@ export class InstrumentationService {
* @private
*/
createVisibilityListener_(callback, config) {
- if (config['visibilitySpec']) {
+ const spec = config['visibilitySpec'];
+ const selector = config['selector'] || (spec && spec['selector']);
@avimehta
avimehta Jul 20, 2016 Collaborator

is this and following variable needed outside the if block?

@rajkumarsrk
rajkumarsrk Jul 20, 2016 edited Contributor

Moved these variables inside the if block

@avimehta
Collaborator

This looks pretty good overall. While we are fixing the final few pieces of feedback and adding documentation, do you mind also signing the CLA?

@avimehta avimehta and 1 other commented on an outdated diff Jul 21, 2016
extensions/amp-analytics/0.1/instrumentation.js
this.runOrSchedule_(() => {
visibilityFor(this.win_).then(visibility => {
- visibility.listenOnce(config['visibilitySpec'], vars => {
+ visibility.listenOnce(config, vars => {
callback(new AnalyticsEvent(AnalyticsEventType.VISIBLE, vars));
@avimehta
avimehta Jul 21, 2016 Collaborator

you should extract the variables and merge them with vars here.

@rajkumarsrk
rajkumarsrk Jul 21, 2016 Contributor

For visibility.listenOnce we need both the visibilitySpec and the merged vars. Merging of vars is done on #L225

@avimehta avimehta commented on an outdated diff Jul 21, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -276,29 +284,51 @@ export class InstrumentationService {
}
/**
+ * @param {!Element} el
+ * @private
+ * @return {Object}
@avimehta
avimehta Jul 21, 2016 edited Collaborator

!Object<string, string>?

@avimehta avimehta and 1 other commented on an outdated diff Jul 21, 2016
extensions/amp-analytics/0.1/visibility-impl.js
@@ -238,18 +239,20 @@ export class Visibility {
* @param {!VisibilityListenerCallbackDef} callback
*/
listenOnce(config, callback) {
- const element = this.win_.document.getElementById(config['selector']
- .slice(1));
+ const spec = config['visibilitySpec'];
@avimehta
avimehta Jul 21, 2016 Collaborator

Once you make the changes I mention in instrumentation.js, you will not have to make any changes to visibility-impl.js

@rajkumarsrk
rajkumarsrk Jul 22, 2016 Contributor

Fixed it

@rajkumarsrk
Contributor

I signed it!

@rajkumarsrk rajkumarsrk reopened this Jul 21, 2016
@avimehta
Collaborator

@rajkumarsrk there seem to be a bunch of unrelated changes in the latest commit. Do you mind rebasing to head and then pushing it here again?

@rajkumarsrk rajkumarsrk Adding element-level overrides for variables on amp-analytics - click…
…, visibile
81dc627
@rajkumarsrk
Contributor

@avimehta Rebased with the latest commit

@avimehta avimehta and 1 other commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/0.1/instrumentation.js
if (!isVisibilitySpecValid(config)) {
return;
}
-
+ const self = this;
@avimehta
avimehta Jul 27, 2016 Collaborator

I am sorry I don't understand. What does this refer to once the context changes? Line 226 uses this while line 228 uses self. Are the two calls being called on two different objects?

@rajkumarsrk
rajkumarsrk Jul 28, 2016 edited Contributor

From chrome debugger the context was pointing to global object, but console log gave me the right one. Sorry for the confusion

screen shot 2016-07-27 at 5 24 38 pm

@avimehta avimehta commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/0.1/instrumentation.js
* @param {!Function} listener
* @param {string} selector
* @private
*/
createSelectiveListener_(listener, selector) {
return e => {
+ let el = e.target;
+ let analyticsVariables = null;
@avimehta
avimehta Jul 27, 2016 Collaborator

you can probably just remove this line and inline the calls to extractAnalyticsVariables.

@avimehta avimehta and 1 other commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/amp-analytics.md
@@ -377,7 +378,7 @@ Use this configuration to fire a request when a specified element is clicked. Us
}
}
```
-
+In addition to the variables provided as part of triggers you can also specific additional / overrides for [variables as data attribute](./analytics-vars.md#variables-as-data-attribute). If used, these data attribute has to be part of element specified as the `selector`
@avimehta
avimehta Jul 27, 2016 Collaborator

In addition to the variables provided as part of triggers, you can also override or specify additional variables as data attributes. If used, these data attributes have to be part of element specified as the selector. Same above.

@rudygalfi Can you take a look at the docs changes?

@rudygalfi
rudygalfi Jul 27, 2016 Contributor

"these data attributes have to be part"

@rudygalfi
rudygalfi Jul 27, 2016 Contributor

"you can also specify additional / overrides"

@avimehta avimehta and 1 other commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/analytics-vars.md
@@ -306,6 +306,24 @@ only available in a `trigger` of type `scroll`. The value of the boundary may be
rounded based on the precision supported by the extension. For example, a
boundary with value `1` and precision of `5` will result in value of var to be 0.
+##Variables as data attribute
@avimehta
avimehta Jul 27, 2016 Collaborator

@rudygalfi please take a look at this as well. I think this can be moved to the top of the page or we should at least have a link to this in the table up top. what do you think?

@rudygalfi
rudygalfi Jul 27, 2016 Contributor

Yes, this should be up top. I would suggest:

  • Keep the header and insert this right under the code example block beginning ""
  • Add a header before "Vars can be defined" called "Variable definitions"
@avimehta
Collaborator

Few minor comments. Rest LGTM.

@rudygalfi rudygalfi commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/amp-analytics.md
@@ -361,6 +361,7 @@ In addition to the conditions above, `visibilitySpec` also enables certain varia
}
```
+In addition to the variables provided as part of triggers you can also specific additional / overrides for [variables as data attribute](./analytics-vars.md#variables-as-data-attribute). If used, these data attribute has to be part of element specified as the `selector`
@rudygalfi
rudygalfi Jul 27, 2016 Contributor

"you can also specify additional / overrides"

@rudygalfi rudygalfi commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/analytics-vars.md
@@ -31,7 +31,7 @@ Vars can be defined by the platform, in the config at the top level, inside the
</amp-analytics>
```
-When the same `var` is defined in multiple locations, the value is picked in the order remote config > triggers > top level > platform. Thus, if the remote config defined `clientId` as `12332312` in the example above, the values of various vars will be as follows:
+When the same `var` is defined in multiple locations, the value is picked in the order remote config > element level data attributes > triggers > top level > platform. Thus, if the remote config defined `clientId` as `12332312` in the example above, the values of various vars will be as follows:
@rudygalfi
rudygalfi Jul 27, 2016 Contributor

Before this section add a header: ## Variable precedence

@rudygalfi rudygalfi commented on the diff Jul 27, 2016
extensions/amp-analytics/analytics-vars.md
@@ -31,7 +31,7 @@ Vars can be defined by the platform, in the config at the top level, inside the
</amp-analytics>
```
@rudygalfi
rudygalfi Jul 27, 2016 Contributor

As noted in a comment below, please add the data elem documentation right after this block, including the header and the code sample.

@rudygalfi rudygalfi commented on an outdated diff Jul 27, 2016
extensions/amp-analytics/analytics-vars.md
@@ -306,6 +306,24 @@ only available in a `trigger` of type `scroll`. The value of the boundary may be
rounded based on the precision supported by the extension. For example, a
boundary with value `1` and precision of `5` will result in value of var to be 0.
+##Variables as data attribute
+For the following event types, variables can be passed as part of the element level data attribute
+
+1. visible
@rudygalfi
rudygalfi Jul 27, 2016 edited Contributor

Should be unordered list (bullets)

@googlebot

CLAs look good, thanks!

@rajkumarsrk rajkumarsrk Updating with review feedback changes
7686732
@rajkumarsrk
Contributor

@avimehta @rudygalfi Thanks for reviewing the changes . I have update the code & documentations

@jridgewell jridgewell and 2 others commented on an outdated diff Jul 28, 2016
extensions/amp-analytics/0.1/instrumentation.js
this.runOrSchedule_(() => {
visibilityFor(this.win_).then(visibility => {
- visibility.listenOnce(config['visibilitySpec'], vars => {
+ visibility.listenOnce(spec, vars => {
+ if (spec['selector']) {
+ const el = this.win_.document.getElementById(spec['selector']
+ .slice(1));
+ Object.assign(vars, this.extractAnalyticsVariables_(el));
@jridgewell
jridgewell Jul 28, 2016 Member

Object.assign is not available in all environments! This will fail!

@avimehta
avimehta Jul 28, 2016 Collaborator

http://kangax.github.io/compat-table/es6/#test-Object_static_methods_Object.assign says that it is not supported IE11 and below, Safari 8 and below. But Babel and closure support it. What can we use here instead? Is a for-loop the best alternative if .assign is undefined?

@rajkumarsrk
rajkumarsrk Aug 2, 2016 Contributor

Modified to for loop instead of Object.assign

@jridgewell jridgewell and 1 other commented on an outdated diff Jul 28, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -276,29 +282,56 @@ export class InstrumentationService {
}
/**
+ * @param {!Element} el
+ * @private
+ * @return {!Object<string, string>}
+ */
+ extractAnalyticsVariables_(el) {
+ const dataSet = el.dataset;
+ const analyticsVariables = {};
+ for (const dataKey in dataSet) {
+ if (dataKey.indexOf(VARS) === 0) {
+ let variableName = dataKey.replace(VARS, '');
+ variableName = variableName[0].toLowerCase() + variableName.slice(1);
@jridgewell
jridgewell Jul 28, 2016 Member

Why would this be uppercase? It's data-vars-variable right?

@avimehta
avimehta Jul 28, 2016 Collaborator

element.dataSet convers everything that follows data into camel case. since 'v' in vars is the first letter, 'v' in variables is capital.

This is the transformation this code is doing:

data-vars-variable-name -> varsVariableName -> VariableName -> variableName

@jridgewell
jridgewell Jul 28, 2016 Member

Ahh, 👍 .

@jridgewell jridgewell and 2 others commented on an outdated diff Jul 28, 2016
extensions/amp-analytics/0.1/instrumentation.js
@@ -276,29 +282,56 @@ export class InstrumentationService {
}
/**
+ * @param {!Element} el
+ * @private
+ * @return {!Object<string, string>}
+ */
+ extractAnalyticsVariables_(el) {
@jridgewell
jridgewell Jul 28, 2016 edited Member

Can this be merged with dom.getDataParamsFromAttributes?

@avimehta
avimehta Jul 28, 2016 Collaborator

Yes, this looks like a good suggestion. Let's do it.

@rajkumarsrk
rajkumarsrk Aug 2, 2016 Contributor

Update to use dom.getDataParamsFromAttributes

rajkumarsrk added some commits Aug 2, 2016
@rajkumarsrk rajkumarsrk Using dom.js for extracting data attributes
2720e3d
@rajkumarsrk rajkumarsrk Merge branch 'master' of https://github.com/ampproject/amphtml
e23ae67
@avimehta avimehta and 2 others commented on an outdated diff Aug 4, 2016
@@ -408,7 +408,9 @@ export function getDataParamsFromAttributes(element, opt_computeParamNameFunc) {
const params = Object.create(null);
for (let i = 0; i < attributes.length; i++) {
const attr = attributes[i];
- const matches = attr.name.match(/^data-param-(.+)/);
+ const attrName = attr.name;
+ const matches = attrName.match(/^data-param-(.+)/) ||
+ attrName.match(/^data-vars-(.+)/);
@avimehta
avimehta Aug 4, 2016 Collaborator

I don't think this will work. This changes the behavior for existing pages/clients. I think we should add another parameter to the function that accepts a regex called opt_paramPattern. If the value is not provided, you can default to /^data-param-(.+)/. Then from instrumentation.js, pass in the value of the pattern.

@avimehta
avimehta Aug 5, 2016 Collaborator

@rajkumarsrk Can you address this comment?

@rajkumarsrk
rajkumarsrk Aug 7, 2016 Contributor

Yup. Added opt_paramPattern and test case has been updated as well

@avimehta avimehta and 2 others commented on an outdated diff Aug 4, 2016
@@ -408,7 +408,9 @@ export function getDataParamsFromAttributes(element, opt_computeParamNameFunc) {
const params = Object.create(null);
for (let i = 0; i < attributes.length; i++) {
const attr = attributes[i];
- const matches = attr.name.match(/^data-param-(.+)/);
+ const attrName = attr.name;
+ const matches = attrName.match(/^data-param-(.+)/) ||
+ attrName.match(/^data-vars-(.+)/);
if (matches) {
const param = dashToCamelCase(matches[1]);
@avimehta
avimehta Aug 4, 2016 Collaborator

@jridgewell any idea why we can't/don't use dataSet here to get the attributes? Seems like that would be a little faster as it does not iterate over all the attributes and doesn't have to do camelCasing here.

@jridgewell
jridgewell Aug 4, 2016 Member

That'd be fine with me.

@rajkumarsrk
rajkumarsrk Aug 7, 2016 Contributor

@avimehta Updated to use dataset

@avimehta
Collaborator
avimehta commented Aug 5, 2016

Just a few more comments and we are good to go! Thanks for your patience so far.

rajkumarsrk added some commits Aug 6, 2016
@rajkumarsrk rajkumarsrk Updating amp-analytics variable overrides with review feedback
ee2413b
@rajkumarsrk rajkumarsrk Merge branch 'master' of https://github.com/ampproject/amphtml
3fe4dfe
@rajkumarsrk rajkumarsrk Fixing lint errors
46e9f19
@avimehta avimehta commented on an outdated diff Aug 8, 2016
@@ -400,24 +399,25 @@ export function childElementsByTag(parent, tagName) {
* @param {!Element} element
* @param {function(string):string} opt_computeParamNameFunc to compute the parameter
* name, get passed the camel-case parameter name.
+ * @param {string} Regex pattern to match data attributes.
@avimehta
avimehta Aug 8, 2016 edited Collaborator

please change type to string= and add the parameter name after the type.

 @param {string=} opt_paramPattern Regex pattern to match data attributes.
@avimehta avimehta added LGTM and removed NEEDS REVIEW labels Aug 8, 2016
@avimehta
Collaborator
avimehta commented Aug 8, 2016 edited

@jridgewell would you like to take another look?

@rajkumarsrk I just have one small comment.

@rajkumarsrk
Contributor

@avimehta 👍 Updated JS doc

@rajkumarsrk rajkumarsrk Updating documentation for amp-analytics
dff8aa2
@avimehta
Collaborator
avimehta commented Aug 8, 2016

@jridgewell I'll merge this PR(to unblock other PRs). Feel free to comment here with more suggestions changes though. I'll address those in a separate PR.

@avimehta avimehta merged commit 5e2eb4a into ampproject:master Aug 8, 2016

2 checks passed

cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rajkumarsrk
Contributor

@avimehta Can you let me know when this feature will be available to consume

@rudygalfi
Contributor

@rajkumarsrk I believe this made it into last week's canary build. That means it should be in production by this Friday the 19th.

You can target's AMP's canary build if you want to try it out. Opt into the dev channel (first option) on this page: https://cdn.ampproject.org/experiments.html.

@georgecrawford georgecrawford referenced this pull request in Financial-Times/google-amp Aug 16, 2016
Merged

Analytics #124

@rajkumarsrk
Contributor

Thanks Rudy

@ariangibson ariangibson added a commit to Mixpo/amphtml that referenced this pull request Sep 7, 2016
@rajkumarsrk @ariangibson rajkumarsrk + ariangibson Added element-level overrides for variables for amp-analytics (#4072)
* Adding element-level overrides for variables on amp-analytics - click, visibile

* Updating with review feedback changes

* Using dom.js for extracting data attributes

* Updating amp-analytics variable overrides with review feedback

* Fixing lint errors

* Updating documentation for amp-analytics
3fbd077
@mityaha mityaha added a commit to ooyala/amphtml that referenced this pull request Nov 30, 2016
@rajkumarsrk @mityaha rajkumarsrk + mityaha Added element-level overrides for variables for amp-analytics (#4072)
* Adding element-level overrides for variables on amp-analytics - click, visibile

* Updating with review feedback changes

* Using dom.js for extracting data attributes

* Updating amp-analytics variable overrides with review feedback

* Fixing lint errors

* Updating documentation for amp-analytics
b7697a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment