Skip to main content

Google Analytics

Aah.towfiq Website
786.justice.help Please Enter Your Information And Login oogle Analytics Google Analytics more_vert Products Google Analytics Tracking AMP Pages Add Analytics to AMP pages Accelerated Mobile Pages (AMP) is a way to build web pages for static content that render fast. AMP includes an element that allows you to track user interactions, and it has built-in support for Google Analytics. Basic setup to track page views To create a basic installation of Google Analytics on an AMP page, copy this code snippet and replace with the property ID you would like to use. (Find your tracking ID.) Important: If an amp-analytics tag configured with type="gtag" already exists in your page's source code, add "GA_TRACKING_ID": { "groups": "default" } to the existing "config" parameter. For optimal performance, do not add a 2nd instance of an amp-analytics tag with type="gtag". How it works The element is an extended AMP component and is explicitly enabled as a custom-element in a script tag. The element block is configured to enable support for Google measurement products. Set the type attribute for to "gtag" (to enable gtag.js support) and the data-credentials attribute to "include" (to enable cookies.) ... AMP does not allow any JavaScript beyond its own approved libraries, so configuration is instead performed with JSON. A gtag_id property with a valid is added to the vars block, and below that a config property with : {} is added as the value. Note: When amp-analytics is configured with a Google Analytics property ID, page_view events are automatically logged by default. Track events Use triggers with defined values to track events in AMP pages. These properties are used in a trigger configuration: selector: a CSS selector to specify a target element. on: specifies the type of event. vars: specify the type of event in event_name, and add additional parameters as necessary. This example demonstrates how to set up a basic Google Analytics event. Create a trigger called "button" that will fire when an element with an ID value of "the-button" is clicked. This trigger will send an event_name value of "login" and a method value of "Google" to Google Analytics: Google Analytics Events are a category of events specific to Google Analytics that are commonly used to build reports on campaigns. These values can be specified in the vars block with event_category, event_label, and value parameters: See the amp-analytics documentation to learn more about trigger configuration. Modify parameters To override default Google Analytics parameters or add new parameters, add the desired values to the parameter section of your config block. This example overrides the default pageview and event values for page_title and page_location: AMP vs non-AMP traffic AMP traffic uses different client IDs from those for web traffic by default. AMP pages load faster and show different traffic patterns than their standard web page counterparts, which can often mean you will get different metrics between AMP and non-AMP traffic. Use of a separate property to measure AMP traffic allows for better analysis of metrics and a more accurate picture of your traffic. If you do need to use a single property to measure both AMP and non-AMP traffic, use the data source dimension or a custom dimension to distinguish them. By default, Google Analytics will send the value "AMP" via the data source dimension. Use this value to segment, filter, or otherwise analyze AMP vs non-AMP content within a single view. Debug your configuration The AMP Validator can be used to identify if a web page doesn't meet the AMP HTML specification. Add #development=1 to the URL of a page to turn on the validator. The amp-analytics extension provides warning and error messages to help debug and troubleshoot a configuration. Add #log=1 to the URL of a page to view logged error messages in your web browser's console. Complete example This example demonstrates a complete AMP page with a single button on a page. This configuration will send standard page view data and "button-click" events to Google Analytics: AMP gtag demo

Make it so.

Related resources AMP: AMP Project AMP: What Is AMP? AMP: amp-analytics gtag.js: Use gtag.js with AMP Google Analytics help center: Accelerated Mobile Pages (AMP) Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Last updated October 26, 2018. GitHub Google+ Stack Overflow Twitter Videos Partners Technology Partner Program Connect Community & Updates Getting Help Reporting an Issue Product Info Protocol / SDK Policy Branding Policy Google Developers Android Chrome Firebase Google Cloud Platform All Products ENGLISH Terms Privacy Sign up for the Google Developers newsletter SUBSCRIBE call:- +8801798381298

Comments