在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):christianhellsten/jquery-google-analytics开源软件地址(OpenSource Url):https://github.com/christianhellsten/jquery-google-analytics开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):jQuery Google Analytics PluginNOTE This plugin hasn’t been updated to work with the latest version of Google Analytics. I recommend you fork and improve the code and submit a patch. IntroductionThe jQuery Google Analytics plugin does the following:
InstallationJavaScriptInside the head tag, first include the jQuery JavaScript file, then the jQuery Google Analytics file: UsageWith the script loaded you now have access to these new methods:
Page trackingTo enable Google Analytics page tracking add a call to $.trackPage inside the head tag: To improve page load times, the script defers the loading of the Google Analytics script to after the page has been loaded (window.onload). To disable this feature, set the onload parameter to false: Tracking 404 and 500 errorsThis plugin implements tracking of error pages as described on the Google Analytics Help pages To track an error, simply set the status_code parameter to the response code, as shown in this example: Link trackingLink tracking is done by selecting the elements you want to track with jQuery selectors. By default the click event is tracked, but this can be changed as I’ll explain later. The following is an example of how to track outgoing links (to also track internal links, set the skip_internal parameter to false): The first example selects links in the sidebar and sets the category to ‘sidebar’. The second example selects links in the footer and sets the category to ‘footer’. The third example selects links located inside the “complex div” and uses the link’s class as category. See index.html for complete examples. Custom event trackingYou can also track events by calling the trackEvent method: ParametersThe track methods accepts the following parameters:
Additional parameters supported by the track(), not the trackEvent(), method:
The following snippet shows you how to define the parameters: If no parameters are given then sensible defaults are used, which should work in most cases. Note that you can also use functions instead of string values. Functions are useful for extracting the values from the HTML itself (metadata). Tracking mouseover and other eventsThe default behavior is to track the click event. This can be changed to any other jQuery event by setting the event_name parameter to the name of the event you want to track, as shown in this example: DebuggingYou can print debug statements to the Firebug console by setting the debug option. Default: false. To enable: Todo
AuthorChristian Hellsten (Aktagon Ltd.) Contributors |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论