Skip to content

Google analytics pageview being triggered twice #12221

Closed
@alexhadley

Description

@alexhadley

Preconditions

  1. Set Analytics code in admin
  2. Load any page

Steps to reproduce

  1. None

Expected result

  1. pageview is triggered once

Actual result

  1. pageview is triggered twice

It looks like a problem in the GoogleAnalytics/view/frontend/web/js/google-analytics.js file, line 54 on, which calls ga('send', 'pageview'... twice:

`

        ga('send', 'pageview' + config.pageTrackingData.optPageUrl);

        // Process orders data
        if (config.ordersTrackingData) {
            ga('require', 'ec', 'ec.js');

            //Set currency code
            ga('set', 'currencyCode', config.ordersTrackingData.currency);

            // Collect product data for GA
            if (config.ordersTrackingData.products) {
                $.each(config.ordersTrackingData.products, function (index, value) {
                    ga('ec:addProduct', value);
                });
            }

            // Collect orders data for GA
            if (config.ordersTrackingData.orders) {
                $.each(config.ordersTrackingData.orders, function (index, value) {
                    ga('ec:setAction', 'purchase', value);
                });
            }

            ga('send', 'pageview');`

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions