| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">Tutorial: Google Analytics</div> | 1 <h1>Tutorial: Google Analytics</h1> |
| 2 <div id="pageData-showTOC" class="pageData">true</div> | 2 |
| 3 | 3 |
| 4 <p>This tutorial demonstrates using Google Analytics to track the usage of your | 4 <p>This tutorial demonstrates using Google Analytics to track the usage of your |
| 5 extension.</p> | 5 extension.</p> |
| 6 | 6 |
| 7 <h2 id="toc-requirements">Requirements</h2> | 7 <h2 id="toc-requirements">Requirements</h2> |
| 8 <p> | 8 <p> |
| 9 This tutorial expects that you have some familiarity writing extensions for | 9 This tutorial expects that you have some familiarity writing extensions for |
| 10 Google Chrome. If you need information on how to write an extension, please | 10 Google Chrome. If you need information on how to write an extension, please |
| 11 read the <a href="gettingstarted.html">Getting Started tutorial</a>. | 11 read the <a href="gettingstarted.html">Getting Started tutorial</a>. |
| 12 </p> | 12 </p> |
| 13 | 13 |
| 14 <p> | 14 <p> |
| 15 You will also need a <a href="http://www.google.com/analytics">Google | 15 You will also need a <a href="http://www.google.com/analytics">Google |
| 16 Analytics account</a> set up to track your extension. Note that when setting | 16 Analytics account</a> set up to track your extension. Note that when setting |
| 17 up the account, you can use any value in the Website's URL field, as your | 17 up the account, you can use any value in the Website's URL field, as your |
| 18 extension will not have an URL of its own. | 18 extension will not have an URL of its own. |
| 19 </p> | 19 </p> |
| 20 | 20 |
| 21 <p style="text-align: center"> | 21 <p style="text-align: center"> |
| 22 <img src="../images/tut_analytics/screenshot01.png" | 22 <img src="{{static}}/images/tut_analytics/screenshot01.png" |
| 23 style="width:400px;height:82px;" | 23 style="width:400px;height:82px;" |
| 24 alt="The analytics setup with info for a chrome extension filled out." /> | 24 alt="The analytics setup with info for a chrome extension filled out." /> |
| 25 </p> | 25 </p> |
| 26 | 26 |
| 27 <h2 id="toc-installing">Installing the tracking code</h2> | 27 <h2 id="toc-installing">Installing the tracking code</h2> |
| 28 | 28 |
| 29 <p> | 29 <p> |
| 30 The standard Google Analytics tracking code snippet fetches a file named | 30 The standard Google Analytics tracking code snippet fetches a file named |
| 31 <code>ga.js</code> from an SSL protected URL if the current page | 31 <code>ga.js</code> from an SSL protected URL if the current page |
| 32 was loaded using the <code>https://</code> protocol. <strong>Chrome | 32 was loaded using the <code>https://</code> protocol. <strong>Chrome |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 the popup is opened. | 114 the popup is opened. |
| 115 </p> | 115 </p> |
| 116 | 116 |
| 117 <p> | 117 <p> |
| 118 By looking at the page view data for each page in your extension, you can | 118 By looking at the page view data for each page in your extension, you can |
| 119 get an idea of how many times your users interact with your extension per | 119 get an idea of how many times your users interact with your extension per |
| 120 browser session: | 120 browser session: |
| 121 </p> | 121 </p> |
| 122 | 122 |
| 123 <p style="text-align: center"> | 123 <p style="text-align: center"> |
| 124 <img src="../images/tut_analytics/screenshot02.png" | 124 <img src="{{static}}/images/tut_analytics/screenshot02.png" |
| 125 style="width:300px;height:119px;" | 125 style="width:300px;height:119px;" |
| 126 alt="Analytics view of the top content for a site." /> | 126 alt="Analytics view of the top content for a site." /> |
| 127 </p> | 127 </p> |
| 128 | 128 |
| 129 <h2 id="toc-debugging">Monitoring analytics requests</h2> | 129 <h2 id="toc-debugging">Monitoring analytics requests</h2> |
| 130 | 130 |
| 131 <p> | 131 <p> |
| 132 To ensure that tracking data from your extension is being sent to Google | 132 To ensure that tracking data from your extension is being sent to Google |
| 133 Analytics, you can inspect the pages of your extension in the | 133 Analytics, you can inspect the pages of your extension in the |
| 134 Developer Tools window (see the | 134 Developer Tools window (see the |
| 135 <a href="tut_debugging.html">debugging tutorial</a> for more information). | 135 <a href="tut_debugging.html">debugging tutorial</a> for more information). |
| 136 As the following figure shows, you should see requests for a file named | 136 As the following figure shows, you should see requests for a file named |
| 137 <strong>__utm.gif</strong> if everything is set up correctly. | 137 <strong>__utm.gif</strong> if everything is set up correctly. |
| 138 </p> | 138 </p> |
| 139 | 139 |
| 140 <p style="text-align: center"> | 140 <p style="text-align: center"> |
| 141 <img src="../images/tut_analytics/screenshot04.png" | 141 <img src="{{static}}/images/tut_analytics/screenshot04.png" |
| 142 style="width:683px;height:418px;" | 142 style="width:683px;height:418px;" |
| 143 alt="Developer Tools window showing the __utm.gif request" /> | 143 alt="Developer Tools window showing the __utm.gif request" /> |
| 144 </p> | 144 </p> |
| 145 | 145 |
| 146 <h2 id="toc-tracking-events">Tracking events</h2> | 146 <h2 id="toc-tracking-events">Tracking events</h2> |
| 147 | 147 |
| 148 <p> | 148 <p> |
| 149 By configuring event tracking, you can determine which parts of your | 149 By configuring event tracking, you can determine which parts of your |
| 150 extension your users interact with the most. For example, if you have | 150 extension your users interact with the most. For example, if you have |
| 151 three buttons users may click: | 151 three buttons users may click: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 177 buttons[i].addEventListener('click', trackButtonClick); | 177 buttons[i].addEventListener('click', trackButtonClick); |
| 178 } | 178 } |
| 179 </pre> | 179 </pre> |
| 180 | 180 |
| 181 <p> | 181 <p> |
| 182 The Google Analytics event tracking overview page will give you metrics | 182 The Google Analytics event tracking overview page will give you metrics |
| 183 regarding how many times each individual button is clicked: | 183 regarding how many times each individual button is clicked: |
| 184 </p> | 184 </p> |
| 185 | 185 |
| 186 <p style="text-align: center"> | 186 <p style="text-align: center"> |
| 187 <img src="../images/tut_analytics/screenshot03.png" | 187 <img src="{{static}}/images/tut_analytics/screenshot03.png" |
| 188 style="width:300px;height:482px;" | 188 style="width:300px;height:482px;" |
| 189 alt="Analytics view of the event tracking data for a site." /> | 189 alt="Analytics view of the event tracking data for a site." /> |
| 190 </p> | 190 </p> |
| 191 | 191 |
| 192 <p> | 192 <p> |
| 193 By using this approach, you can see which parts of your extension are | 193 By using this approach, you can see which parts of your extension are |
| 194 under-or-overutilized. This information can help guide decisions about UI | 194 under-or-overutilized. This information can help guide decisions about UI |
| 195 redesigns or additional functionality to implement. | 195 redesigns or additional functionality to implement. |
| 196 </p> | 196 </p> |
| 197 | 197 |
| 198 <p> | 198 <p> |
| 199 For more information about using the event tracking API, see the | 199 For more information about using the event tracking API, see the |
| 200 Google Analytics | 200 Google Analytics |
| 201 <a href="http://code.google.com/apis/analytics/docs/tracking/eventTrackerOverv
iew.html">developer | 201 <a href="http://code.google.com/apis/analytics/docs/tracking/eventTrackerOverv
iew.html">developer |
| 202 documentation</a>. | 202 documentation</a>. |
| 203 </p> | 203 </p> |
| 204 | 204 |
| 205 <h2 id="toc-samplecode">Sample code</h2> | 205 <h2 id="toc-samplecode">Sample code</h2> |
| 206 | 206 |
| 207 <p> | 207 <p> |
| 208 A sample extension that uses these techniques is | 208 A sample extension that uses these techniques is |
| 209 available in the Chromium source tree: | 209 available in the Chromium source tree: |
| 210 </p> | 210 </p> |
| 211 | 211 |
| 212 <blockquote> | 212 <blockquote> |
| 213 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensi
ons/docs/examples/tutorials/analytics/">.../examples/tutorials/analytics/</a> | 213 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensi
ons/docs/examples/tutorials/analytics/">.../examples/tutorials/analytics/</a> |
| 214 </blockquote> | 214 </blockquote> |
| 215 </p> | |
| OLD | NEW |