{"action":"created","comment":{"url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/comments/43361928","id":43361928,"diff_hunk":"@@ -328,106 +300,37 @@ public function do_tracking() {\n \t}\n \n \t/**\n-\t * Return the target with a lot of parameters\n-\t *\n-\t * @param string $category\n-\t * @param array  $matches\n+\t * Setting the filters for tracking outbound links\n \t *\n-\t * @return array\n \t */\n-\tprotected function get_target( $category, $matches ) {\n-\t\t$protocol     = $matches[3];\n-\t\t$original_url = $matches[4];\n-\t\t$domain       = $this->yoast_ga_get_domain( $matches[4] );\n-\t\t$http_host    = empty( $_SERVER['HTTP_HOST'] ) ? '' : $_SERVER['HTTP_HOST'];\n-\t\t$origin       = $this->yoast_ga_get_domain( $http_host );\n-\t\t$extension    = substr( strrchr( $original_url, '.' ), 1 );\n-\t\t$type         = $this->get_target_type( $extension, $domain, $origin, $matches );\n-\n-\t\treturn array(\n-\t\t\t'category'        => $category,\n-\t\t\t'type'            => $type,\n-\t\t\t'protocol'        => $protocol,\n-\t\t\t'domain'          => $domain['domain'],\n-\t\t\t'host'            => $domain['host'],\n-\t\t\t'origin_domain'   => $origin['domain'],\n-\t\t\t'origin_host'     => $origin['host'],\n-\t\t\t'extension'       => $extension,\n-\t\t\t'link_attributes' => trim( $matches[1] . ' ' . $matches[5] ),\n-\t\t\t'link_text'       => $matches[6],\n-\t\t\t'original_url'    => $original_url,\n-\t\t);\n+\tprotected function track_outbound_filters() {\n+\t\tadd_filter( 'the_content', array( $this, 'the_content' ), 99 );\n+\t\tadd_filter( 'widget_text', array( $this, 'widget_content' ), 99 );\n+\t\tadd_filter( 'wp_list_bookmarks', array( $this, 'widget_content' ), 99 );\n+\t\tadd_filter( 'wp_nav_menu', array( $this, 'widget_content' ), 99 );\n+\t\tadd_filter( 'the_excerpt', array( $this, 'the_content' ), 99 );\n+\t\tadd_filter( 'comment_text', array( $this, 'comment_text' ), 99 );\n \t}\n \n \t/**\n-\t * Getting the type for current target\n+\t * Get the output tracking link\n \t *\n-\t * @param string $extension\n-\t * @param array  $domain\n-\t * @param array  $origin\n+\t * @param string $category\n \t * @param array  $matches\n \t *\n-\t * @return null|string\n+\t * @return mixed\n \t */\n-\tprotected function get_target_type( $extension, $domain, $origin, $matches ) {\n-\t\t$download_extensions = explode( ',', str_replace( '.', '', $this->options['extensions_of_files'] ) );\n-\t\t$download_extensions = array_map( 'trim', $download_extensions );\n-\t\t$protocol            = $matches[3];\n-\t\t$original_url        = $matches[4];\n-\n-\t\t// Break out immediately if the link is not an http or https link.\n-\t\t$type = null;\n-\t\tif ( $protocol !== 'http' && $protocol !== 'https' && $protocol !== 'mailto' ) {\n-\t\t\t$type = null;\n-\t\t}\n-\t\telse {\n-\t\t\tif ( ( $protocol == 'mailto' ) ) {\n-\t\t\t\t$type = 'email';\n-\t\t\t}\n-\t\t\telseif ( in_array( $extension, $download_extensions ) ) {\n-\t\t\t\t$type = 'download';\n-\t\t\t}\n-\t\t\telse {\n-\t\t\t\t$type = $this->parse_outbound_type( $domain, $origin, $original_url );\n-\t\t\t}\n-\t\t}\n-\n-\t\treturn $type;\n+\tprotected function parse_link( $category, $matches ) {\n+\t\treturn $this->output_parse_link( $category, new Yoast_GA_Link_Target( $category, $matches, $this->options ) );\n \t}\n \n \t/**\n-\t * Parse the type for outbound links\n-\t *\n-\t * @param array  $domain\n-\t * @param array  $origin\n-\t * @param string $original_url\n+\t * Get the options class\n \t *\n-\t * @return string\n+\t * @return object|Yoast_GA_Options","path":"frontend/abstract-class-tracking.php","position":317,"original_position":317,"commit_id":"918b02e2c313b55857dc964aaf4df2ad75207f4d","original_commit_id":"918b02e2c313b55857dc964aaf4df2ad75207f4d","user":{"login":"andizer","id":325040,"avatar_url":"https://avatars.githubusercontent.com/u/325040?v=3","gravatar_id":"","url":"https://api.github.com/users/andizer","html_url":"https://github.com/andizer","followers_url":"https://api.github.com/users/andizer/followers","following_url":"https://api.github.com/users/andizer/following{/other_user}","gists_url":"https://api.github.com/users/andizer/gists{/gist_id}","starred_url":"https://api.github.com/users/andizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andizer/subscriptions","organizations_url":"https://api.github.com/users/andizer/orgs","repos_url":"https://api.github.com/users/andizer/repos","events_url":"https://api.github.com/users/andizer/events{/privacy}","received_events_url":"https://api.github.com/users/andizer/received_events","type":"User","site_admin":false},"body":"He always returns `Yoast_GA_Options` which is an object, thus `object|` can be removed.  ","created_at":"2015-10-29T08:59:38Z","updated_at":"2015-10-29T08:59:38Z","html_url":"https://github.com/Yoast/google-analytics-for-wordpress/pull/439#discussion_r43361928","pull_request_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439","_links":{"self":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/comments/43361928"},"html":{"href":"https://github.com/Yoast/google-analytics-for-wordpress/pull/439#discussion_r43361928"},"pull_request":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439"}}},"pull_request":{"url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439","id":48874153,"html_url":"https://github.com/Yoast/google-analytics-for-wordpress/pull/439","diff_url":"https://github.com/Yoast/google-analytics-for-wordpress/pull/439.diff","patch_url":"https://github.com/Yoast/google-analytics-for-wordpress/pull/439.patch","issue_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/439","number":439,"state":"open","locked":false,"title":"Stories/cg/internal links outbound full url","user":{"login":"CarolineGeven","id":8614579,"avatar_url":"https://avatars.githubusercontent.com/u/8614579?v=3","gravatar_id":"","url":"https://api.github.com/users/CarolineGeven","html_url":"https://github.com/CarolineGeven","followers_url":"https://api.github.com/users/CarolineGeven/followers","following_url":"https://api.github.com/users/CarolineGeven/following{/other_user}","gists_url":"https://api.github.com/users/CarolineGeven/gists{/gist_id}","starred_url":"https://api.github.com/users/CarolineGeven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CarolineGeven/subscriptions","organizations_url":"https://api.github.com/users/CarolineGeven/orgs","repos_url":"https://api.github.com/users/CarolineGeven/repos","events_url":"https://api.github.com/users/CarolineGeven/events{/privacy}","received_events_url":"https://api.github.com/users/CarolineGeven/received_events","type":"User","site_admin":false},"body":"Fixes #425 ","created_at":"2015-10-27T14:02:19Z","updated_at":"2015-10-29T08:59:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82d56a53f7fe9374147a3199269f3785e46e77a1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439/commits","review_comments_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439/comments","review_comment_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/439/comments","statuses_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/statuses/918b02e2c313b55857dc964aaf4df2ad75207f4d","head":{"label":"Yoast:stories/CG/internal-links-outbound-full-url","ref":"stories/CG/internal-links-outbound-full-url","sha":"918b02e2c313b55857dc964aaf4df2ad75207f4d","user":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"repo":{"id":11945060,"name":"google-analytics-for-wordpress","full_name":"Yoast/google-analytics-for-wordpress","owner":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yoast/google-analytics-for-wordpress","description":"Add Google Analytics to WordPress and be able to use all the powerful functions Google Analytics offers","fork":false,"url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress","forks_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/forks","keys_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/teams","hooks_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/hooks","issue_events_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/events{/number}","events_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/events","assignees_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/assignees{/user}","branches_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/branches{/branch}","tags_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/tags","blobs_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/statuses/{sha}","languages_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/languages","stargazers_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/stargazers","contributors_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/contributors","subscribers_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/subscribers","subscription_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/subscription","commits_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/contents/{+path}","compare_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/merges","archive_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/downloads","issues_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues{/number}","pulls_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls{/number}","milestones_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/milestones{/number}","notifications_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/labels{/name}","releases_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/releases{/id}","created_at":"2013-08-07T08:23:34Z","updated_at":"2015-10-22T09:37:21Z","pushed_at":"2015-10-28T14:58:21Z","git_url":"git://github.com/Yoast/google-analytics-for-wordpress.git","ssh_url":"git@github.com:Yoast/google-analytics-for-wordpress.git","clone_url":"https://github.com/Yoast/google-analytics-for-wordpress.git","svn_url":"https://github.com/Yoast/google-analytics-for-wordpress","homepage":null,"size":6081,"stargazers_count":90,"watchers_count":90,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":59,"forks":54,"open_issues":59,"watchers":90,"default_branch":"trunk"}},"base":{"label":"Yoast:trunk","ref":"trunk","sha":"a42c216389aa26eb0c2e0f474921e55436310819","user":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"repo":{"id":11945060,"name":"google-analytics-for-wordpress","full_name":"Yoast/google-analytics-for-wordpress","owner":{"login":"Yoast","id":4690436,"avatar_url":"https://avatars.githubusercontent.com/u/4690436?v=3","gravatar_id":"","url":"https://api.github.com/users/Yoast","html_url":"https://github.com/Yoast","followers_url":"https://api.github.com/users/Yoast/followers","following_url":"https://api.github.com/users/Yoast/following{/other_user}","gists_url":"https://api.github.com/users/Yoast/gists{/gist_id}","starred_url":"https://api.github.com/users/Yoast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yoast/subscriptions","organizations_url":"https://api.github.com/users/Yoast/orgs","repos_url":"https://api.github.com/users/Yoast/repos","events_url":"https://api.github.com/users/Yoast/events{/privacy}","received_events_url":"https://api.github.com/users/Yoast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Yoast/google-analytics-for-wordpress","description":"Add Google Analytics to WordPress and be able to use all the powerful functions Google Analytics offers","fork":false,"url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress","forks_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/forks","keys_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/teams","hooks_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/hooks","issue_events_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/events{/number}","events_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/events","assignees_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/assignees{/user}","branches_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/branches{/branch}","tags_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/tags","blobs_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/refs{/sha}","trees_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/statuses/{sha}","languages_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/languages","stargazers_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/stargazers","contributors_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/contributors","subscribers_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/subscribers","subscription_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/subscription","commits_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/commits{/sha}","git_commits_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/git/commits{/sha}","comments_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/comments{/number}","issue_comment_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/comments{/number}","contents_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/contents/{+path}","compare_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/merges","archive_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/downloads","issues_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues{/number}","pulls_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls{/number}","milestones_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/milestones{/number}","notifications_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/labels{/name}","releases_url":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/releases{/id}","created_at":"2013-08-07T08:23:34Z","updated_at":"2015-10-22T09:37:21Z","pushed_at":"2015-10-28T14:58:21Z","git_url":"git://github.com/Yoast/google-analytics-for-wordpress.git","ssh_url":"git@github.com:Yoast/google-analytics-for-wordpress.git","clone_url":"https://github.com/Yoast/google-analytics-for-wordpress.git","svn_url":"https://github.com/Yoast/google-analytics-for-wordpress","homepage":null,"size":6081,"stargazers_count":90,"watchers_count":90,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":59,"forks":54,"open_issues":59,"watchers":90,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439"},"html":{"href":"https://github.com/Yoast/google-analytics-for-wordpress/pull/439"},"issue":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/439"},"comments":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/issues/439/comments"},"review_comments":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439/comments"},"review_comment":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/pulls/439/commits"},"statuses":{"href":"https://api.github.com/repos/Yoast/google-analytics-for-wordpress/statuses/918b02e2c313b55857dc964aaf4df2ad75207f4d"}}}}