google / google/site-kit-wp

Review Linker (cross domain tracking) usage

Open
#7,988 0 comments 0 reactions 0 assignees View on GitHub
Module: Analytics Type: Enhancement Type: Support
Dominant language
JavaScript
Stars
1.4k
Forks
384
Avg merge
4d 14h
Merged PRs (30d)
77

Description

## Bug Description

When the Analytics snippet is placed via Site Kit, we use the Linker tag as per the below in order to achieve cross domain tracking between a site and it's AMP version (view also [this sample full snippet](https://sitekit.withgoogle.com/documentation/using-site-kit/site-kit-modules-and-your-sites-source-code/#googleanalytics:~:text=gtag(%27set%27%2C%20%27linker%27%2C%20%7B%22domains%22%3A%5B%22example.com%22%5D%7D%20)%3B))
`gtag('set', 'linker', {"domains":["example.com"]} );`

We add this linker tag to both [a standard web tag](https://github.com/google/site-kit-wp/blob/7b715060ca674fdbdb0f1d753b8306af59498613/includes/Modules/Analytics/Web_Tag.php#L140) and to [AMP placements](https://github.com/google/site-kit-wp/issues/1160).

As per [a users request in the support forums](https://wordpress.org/support/topic/strange-url-error/#post-17274600), consider how we're placing this linker tag, and whether we should be placing it for non-AMP users. Consider also a filter to remove the linker domain for users who specifically request doing so.

## User related queries in the Site Kit support forums

- https://wordpress.org/support/topic/strange-url-error
- https://wordpress.org/support/topic/how-to-remove-the-url-tag/
- https://wordpress.org/support/topic/url-site-staan-allemaal-tekens-achter-korte-url/
- https://wordpress.org/support/topic/sit-kit-appends-to-a-url-breaking-the-target-site/

## Additional Context

- Site Kit 1.115.0
- Discussed in [recent support/eng sync](https://docs.google.com/document/d/1Dz-IVEo0TAv-FUY8ers0gB10qS0N6_s2ToMN4_u2Sj0/edit?pli=1#bookmark=id.na5e88yv01th)

cc. @aaemnnosttv

---------------

_Do not alter or remove anything below. The following sections will be managed by moderators only._

## Acceptance criteria

*

## Implementation Brief

* [ ]

### Test Coverage

*

## QA Brief

*

## Changelog entry

*

Contributor guide

Open the contributing guide

Research direction

Start with includes/Modules/Analytics/Web_Tag.php around line 140 and review the AMP placement described in issue #1160. Compare those placements with the linked full snippet and the reported support cases. Done means reaching a clear decision about non-AMP linker usage and whether users need a way to remove the linker domain.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php, wordpress
Domain
analytics, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.