magento / magento/community-features

Google Analytics code being placed in body instead of head

Open
#29 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

moved from magento2 Priority: P4
Dominant language
No language data
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

### Preconditions

1. Magento version 2.1.5
2. Google Analytics Account

### Steps to reproduce

1. Enable Google Analytics in Magento by going to Stores->Configuration->Sales->Google API
2. Add your Google Account Number and Save

### Expected result

1. The Google Analytics code should be output neat the top the the tag on the page

### Actual result

1. The Google Analytics code is output near the top of the tag

Reference: https://developers.google.com/analytics/devguides/collection/analyticsjs/

**Original Report**: https://github.com/magento/magento2/issues/8837 by @mombrea

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Magento's Google Analytics configuration and the generated page markup, then compare where the tracking code is inserted relative to the head and body. Done means the configured Google Analytics code appears near the top of the page head, with coverage for the corrected placement if the existing test structure supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
analytics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.