{"action":"created","comment":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/81024630","pull_request_review_id":2036078,"id":81024630,"diff_hunk":"@@ -477,31 +472,81 @@ export class AmpAnalytics extends AMP.BaseElement {\n     // Precedence is event.vars > trigger.vars > config.vars.\n     // Nested expansion not supported.\n     return expandTemplate(template, key => {\n-      const match = key.match(/([^(]*)(\\([^)]*\\))?/);\n-      const name = match[1];\n-      const argList = match[2] || '';\n+      const {name, argList} = this.getNameArgs_(key);\n       let raw = (event && event['vars'] && event['vars'][name]) ||\n           (trigger['vars'] && trigger['vars'][name]) ||\n           (this.config_['vars'] && this.config_['vars'][name]) ||\n           '';\n+\n+      // Values can also be arrays and objects. Don't expand them.\n       if (typeof raw == 'string') {\n         raw = this.expandTemplate_(raw, trigger, event, opt_iterations - 1);\n       }\n       const val = opt_encode ? this.encodeVars_(raw, name) : raw;\n-      return val + argList;\n+      return val ? val + argList : val;\n     });\n   }\n \n   /**\n+   * Returns an array containing two values: name and args parsed from the key.\n+   *\n+   * @param {string} key The key to be parsed.\n+   * @return {Object<string>}","path":"extensions/amp-analytics/0.1/amp-analytics.js","position":null,"original_position":50,"commit_id":"dc12817cadd5c52130ca7f6bbe9d99cdf75c1d53","original_commit_id":"5b7ee7204cd262c71cbdcd8300efac784e38a08c","user":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-09-28T21:46:00Z","updated_at":"2016-09-28T21:46:00Z","html_url":"https://github.com/ampproject/amphtml/pull/4855#discussion_r81024630","pull_request_url":"https://api.github.com/repos/ampproject/amphtml/pulls/4855","_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments/81024630"},"html":{"href":"https://github.com/ampproject/amphtml/pull/4855#discussion_r81024630"},"pull_request":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4855"}}},"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/4855","id":84397423,"html_url":"https://github.com/ampproject/amphtml/pull/4855","diff_url":"https://github.com/ampproject/amphtml/pull/4855.diff","patch_url":"https://github.com/ampproject/amphtml/pull/4855.patch","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/4855","number":4855,"state":"open","locked":false,"title":"Support for expansion of variables with params in parts of amp-analytics.","user":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"body":"Specifically, the `vars` and extraUrlParams` section encoded the\r\nvariables with params before they could be expanded.\r\n\r\nFixes #4825","created_at":"2016-09-08T00:41:44Z","updated_at":"2016-09-28T21:46:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d1347eaa59fdf255ba30add40819fe6535b14ca7","assignee":{"login":"jridgewell","id":112982,"avatar_url":"https://avatars.githubusercontent.com/u/112982?v=3","gravatar_id":"","url":"https://api.github.com/users/jridgewell","html_url":"https://github.com/jridgewell","followers_url":"https://api.github.com/users/jridgewell/followers","following_url":"https://api.github.com/users/jridgewell/following{/other_user}","gists_url":"https://api.github.com/users/jridgewell/gists{/gist_id}","starred_url":"https://api.github.com/users/jridgewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jridgewell/subscriptions","organizations_url":"https://api.github.com/users/jridgewell/orgs","repos_url":"https://api.github.com/users/jridgewell/repos","events_url":"https://api.github.com/users/jridgewell/events{/privacy}","received_events_url":"https://api.github.com/users/jridgewell/received_events","type":"User","site_admin":false},"assignees":[{"login":"jridgewell","id":112982,"avatar_url":"https://avatars.githubusercontent.com/u/112982?v=3","gravatar_id":"","url":"https://api.github.com/users/jridgewell","html_url":"https://github.com/jridgewell","followers_url":"https://api.github.com/users/jridgewell/followers","following_url":"https://api.github.com/users/jridgewell/following{/other_user}","gists_url":"https://api.github.com/users/jridgewell/gists{/gist_id}","starred_url":"https://api.github.com/users/jridgewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jridgewell/subscriptions","organizations_url":"https://api.github.com/users/jridgewell/orgs","repos_url":"https://api.github.com/users/jridgewell/repos","events_url":"https://api.github.com/users/jridgewell/events{/privacy}","received_events_url":"https://api.github.com/users/jridgewell/received_events","type":"User","site_admin":false},{"login":"dvoytenko","id":726049,"avatar_url":"https://avatars.githubusercontent.com/u/726049?v=3","gravatar_id":"","url":"https://api.github.com/users/dvoytenko","html_url":"https://github.com/dvoytenko","followers_url":"https://api.github.com/users/dvoytenko/followers","following_url":"https://api.github.com/users/dvoytenko/following{/other_user}","gists_url":"https://api.github.com/users/dvoytenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dvoytenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvoytenko/subscriptions","organizations_url":"https://api.github.com/users/dvoytenko/orgs","repos_url":"https://api.github.com/users/dvoytenko/repos","events_url":"https://api.github.com/users/dvoytenko/events{/privacy}","received_events_url":"https://api.github.com/users/dvoytenko/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ampproject/amphtml/pulls/4855/commits","review_comments_url":"https://api.github.com/repos/ampproject/amphtml/pulls/4855/comments","review_comment_url":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/4855/comments","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/dc12817cadd5c52130ca7f6bbe9d99cdf75c1d53","head":{"label":"avimehta:bug","ref":"bug","sha":"dc12817cadd5c52130ca7f6bbe9d99cdf75c1d53","user":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"repo":{"id":44332738,"name":"amphtml","full_name":"avimehta/amphtml","owner":{"login":"avimehta","id":179359,"avatar_url":"https://avatars.githubusercontent.com/u/179359?v=3","gravatar_id":"","url":"https://api.github.com/users/avimehta","html_url":"https://github.com/avimehta","followers_url":"https://api.github.com/users/avimehta/followers","following_url":"https://api.github.com/users/avimehta/following{/other_user}","gists_url":"https://api.github.com/users/avimehta/gists{/gist_id}","starred_url":"https://api.github.com/users/avimehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avimehta/subscriptions","organizations_url":"https://api.github.com/users/avimehta/orgs","repos_url":"https://api.github.com/users/avimehta/repos","events_url":"https://api.github.com/users/avimehta/events{/privacy}","received_events_url":"https://api.github.com/users/avimehta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/avimehta/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":true,"url":"https://api.github.com/repos/avimehta/amphtml","forks_url":"https://api.github.com/repos/avimehta/amphtml/forks","keys_url":"https://api.github.com/repos/avimehta/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avimehta/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avimehta/amphtml/teams","hooks_url":"https://api.github.com/repos/avimehta/amphtml/hooks","issue_events_url":"https://api.github.com/repos/avimehta/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/avimehta/amphtml/events","assignees_url":"https://api.github.com/repos/avimehta/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/avimehta/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/avimehta/amphtml/tags","blobs_url":"https://api.github.com/repos/avimehta/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avimehta/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avimehta/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/avimehta/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avimehta/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/avimehta/amphtml/languages","stargazers_url":"https://api.github.com/repos/avimehta/amphtml/stargazers","contributors_url":"https://api.github.com/repos/avimehta/amphtml/contributors","subscribers_url":"https://api.github.com/repos/avimehta/amphtml/subscribers","subscription_url":"https://api.github.com/repos/avimehta/amphtml/subscription","commits_url":"https://api.github.com/repos/avimehta/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/avimehta/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/avimehta/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/avimehta/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/avimehta/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/avimehta/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avimehta/amphtml/merges","archive_url":"https://api.github.com/repos/avimehta/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avimehta/amphtml/downloads","issues_url":"https://api.github.com/repos/avimehta/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/avimehta/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/avimehta/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/avimehta/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avimehta/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/avimehta/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/avimehta/amphtml/deployments","created_at":"2015-10-15T17:06:23Z","updated_at":"2016-08-26T22:13:27Z","pushed_at":"2016-09-28T21:45:11Z","git_url":"git://github.com/avimehta/amphtml.git","ssh_url":"git@github.com:avimehta/amphtml.git","clone_url":"https://github.com/avimehta/amphtml.git","svn_url":"https://github.com/avimehta/amphtml","homepage":"https://ampproject.org","size":164835,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"ampproject:master","ref":"master","sha":"5496a1fcb123d915ec1cade4e62ab9464c87dc28","user":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars.githubusercontent.com/u/14114390?v=3","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"repo":{"id":41766002,"name":"amphtml","full_name":"ampproject/amphtml","owner":{"login":"ampproject","id":14114390,"avatar_url":"https://avatars.githubusercontent.com/u/14114390?v=3","gravatar_id":"","url":"https://api.github.com/users/ampproject","html_url":"https://github.com/ampproject","followers_url":"https://api.github.com/users/ampproject/followers","following_url":"https://api.github.com/users/ampproject/following{/other_user}","gists_url":"https://api.github.com/users/ampproject/gists{/gist_id}","starred_url":"https://api.github.com/users/ampproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ampproject/subscriptions","organizations_url":"https://api.github.com/users/ampproject/orgs","repos_url":"https://api.github.com/users/ampproject/repos","events_url":"https://api.github.com/users/ampproject/events{/privacy}","received_events_url":"https://api.github.com/users/ampproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ampproject/amphtml","description":"AMP HTML source code, samples, and documentation.  See below for more info.","fork":false,"url":"https://api.github.com/repos/ampproject/amphtml","forks_url":"https://api.github.com/repos/ampproject/amphtml/forks","keys_url":"https://api.github.com/repos/ampproject/amphtml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ampproject/amphtml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ampproject/amphtml/teams","hooks_url":"https://api.github.com/repos/ampproject/amphtml/hooks","issue_events_url":"https://api.github.com/repos/ampproject/amphtml/issues/events{/number}","events_url":"https://api.github.com/repos/ampproject/amphtml/events","assignees_url":"https://api.github.com/repos/ampproject/amphtml/assignees{/user}","branches_url":"https://api.github.com/repos/ampproject/amphtml/branches{/branch}","tags_url":"https://api.github.com/repos/ampproject/amphtml/tags","blobs_url":"https://api.github.com/repos/ampproject/amphtml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ampproject/amphtml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ampproject/amphtml/git/refs{/sha}","trees_url":"https://api.github.com/repos/ampproject/amphtml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ampproject/amphtml/statuses/{sha}","languages_url":"https://api.github.com/repos/ampproject/amphtml/languages","stargazers_url":"https://api.github.com/repos/ampproject/amphtml/stargazers","contributors_url":"https://api.github.com/repos/ampproject/amphtml/contributors","subscribers_url":"https://api.github.com/repos/ampproject/amphtml/subscribers","subscription_url":"https://api.github.com/repos/ampproject/amphtml/subscription","commits_url":"https://api.github.com/repos/ampproject/amphtml/commits{/sha}","git_commits_url":"https://api.github.com/repos/ampproject/amphtml/git/commits{/sha}","comments_url":"https://api.github.com/repos/ampproject/amphtml/comments{/number}","issue_comment_url":"https://api.github.com/repos/ampproject/amphtml/issues/comments{/number}","contents_url":"https://api.github.com/repos/ampproject/amphtml/contents/{+path}","compare_url":"https://api.github.com/repos/ampproject/amphtml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ampproject/amphtml/merges","archive_url":"https://api.github.com/repos/ampproject/amphtml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ampproject/amphtml/downloads","issues_url":"https://api.github.com/repos/ampproject/amphtml/issues{/number}","pulls_url":"https://api.github.com/repos/ampproject/amphtml/pulls{/number}","milestones_url":"https://api.github.com/repos/ampproject/amphtml/milestones{/number}","notifications_url":"https://api.github.com/repos/ampproject/amphtml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ampproject/amphtml/labels{/name}","releases_url":"https://api.github.com/repos/ampproject/amphtml/releases{/id}","deployments_url":"https://api.github.com/repos/ampproject/amphtml/deployments","created_at":"2015-09-01T22:10:53Z","updated_at":"2016-09-28T16:29:22Z","pushed_at":"2016-09-28T21:45:12Z","git_url":"git://github.com/ampproject/amphtml.git","ssh_url":"git@github.com:ampproject/amphtml.git","clone_url":"https://github.com/ampproject/amphtml.git","svn_url":"https://github.com/ampproject/amphtml","homepage":"https://ampproject.org","size":205042,"stargazers_count":8667,"watchers_count":8667,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1281,"mirror_url":null,"open_issues_count":799,"forks":1281,"open_issues":799,"watchers":8667,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4855"},"html":{"href":"https://github.com/ampproject/amphtml/pull/4855"},"issue":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/4855"},"comments":{"href":"https://api.github.com/repos/ampproject/amphtml/issues/4855/comments"},"review_comments":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4855/comments"},"review_comment":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ampproject/amphtml/pulls/4855/commits"},"statuses":{"href":"https://api.github.com/repos/ampproject/amphtml/statuses/dc12817cadd5c52130ca7f6bbe9d99cdf75c1d53"}}}}
{"actor":{"display_login":"avimehta"}}