Google Analytics e-commerce (Universal Edition)

Source: Internet
Author: User
Tags subdomain name

Google Analytics is a new method used to measure and analyze website traffic and browsing behaviors. Recently, I just came into contact and found that its functions are really powerful. I recorded the e-commerce configuration method. (For Beginners, Do not spray on old birds)

Google Analytics has a very convenient API that provides webpage JS scripts, IOS, Android SDK, and other convenient interfaces for different client options. For details, refer to the official website: Google Analytics official website.

Of course, the document is simple and easy to understand, but some of the descriptions need to find different chapters to understand the configuration. Here we record the previously configured E-Commerce article.

1. Google Analytics must be added globally as follows:

To start tracing websites using Analytics. JS, paste the following JavaScript code snippet into the website template pageEnd tag Front (you can also put it at the bottom. The advantage is that Google Analytics can be loaded at the end to avoid slowing down the loading speed of your website files ).UA-XXXX-YThe parameter must be replaced with the network media resource ID of the Google network media resource to be tracked.

<!-- Google Analytics --><script>(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject‘]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,‘script‘,‘//www.google-analytics.com/analytics.js‘,‘ga‘);ga(‘create‘, ‘UA-XXXX-Y‘, ‘auto‘);ga(‘send‘, ‘pageview‘);</script><!-- End Google Analytics -->

When the code is run, the Google Analytics tracking code is asynchronously loaded to the page, andUA-XXXX-YThe Network Media Resource specified in the parameter to create the tracker object. Finally, it records the web page browsing for the web page running scripts in Google Analytics (analysis.

Note: To modify the create statement for a subdomain name, specify the specified domain name:

 

Appendix: Explanations

 

2. Load e-commerce plug-ins

ga(‘require‘, ‘ecommerce‘);

This command must be used when you create a tracker objectAfter, Use any specific e-commerce functionsBeforeRun. (That is, after the above ga object)

3. Add transaction:

After the plug-in is loaded, a transparent shopping cart object is created. You can add transaction and item data to the shopping cart and send all the data at a time after the configuration is complete. Example:

3.1: add the total amount of the transaction order

ga(‘ecommerce:addTransaction‘, {  ‘id‘: ‘1234‘,                     // Transaction ID. Required.  ‘affiliation‘: ‘Acme Clothing‘,   // Affiliation or store name.  ‘revenue‘: ‘11.99‘,               // Grand Total.  ‘shipping‘: ‘5‘,                  // Shipping.  ‘tax‘: ‘1.29‘                     // Tax.});

3.2: Add transaction order product

ga(‘ecommerce:addItem‘, {  ‘id‘: ‘1234‘,                     // Transaction ID. Required.  ‘name‘: ‘Fluffy Pink Bunnies‘,    // Product name. Required.  ‘sku‘: ‘DD23444‘,                 // SKU/code.  ‘category‘: ‘Party Toys‘,         // Category or variation.  ‘price‘: ‘11.99‘,                 // Unit price.  ‘quantity‘: ‘1‘                   // Quantity.});

4. Send data:

ga(‘ecommerce:send‘);

Note:The currency set in Google Analytics by default is not specified for the data sent above: (you do not need to add the specified symbol, you only need the corresponding number)

By default, you can configure a universal global currency for all transactions and commodities on the Google Analytics (analysis) management network interface. By default, global currency is used for all commodities and transactions. Websites that use multiple currencies for transactions can use e-commerce plug-ins to specify the local currency of transactions and individual products.

The local currency must beISO 4217Standard. For a complete list of supported conversion currencies, see the reference documentation for the currency code.

Specify the currency method:

ga(‘ecommerce:addTransaction‘, {  ‘id‘: ‘1234‘,  ‘affiliation‘: ‘Acme Clothing‘,  ‘revenue‘: ‘11.99‘,  ‘shipping‘: ‘5‘,  ‘tax‘: ‘1.29‘,  ‘currency‘: ‘EUR‘  // local currency code.});

 

Finally, Let's explain:Google Analytics e-commerce data can be viewed only after the e-commerce view is enabled, and its data is not real-time data. It takes several hours (you can see the data after around 4-5 hours) to see whether the data is successful, it is recommended to view the information in 24 hours..

Pure record memo. For more information, please go to the official website to view more detailed documents. Thank you!

 

Google Analytics e-commerce (Universal Edition)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.