I am building an AMP website, and I use google analytics for tracking. However I found the utm_campaign, utm_source and utm_medium properties are not working when I migrate my site to AMP, it was working when I was using analytics.js. I tried to add ?utm_source=some_value&utm_campaign=some_value&utm_medium=some_value at the end of url, it doesn't work. I tried to add these values through extraUrlParams in the amp-analytics configuration like this: "extraUrlParams": {"utm_source": "test", "utm_campaign": "test", "utm_medium": "test"}, it doesn't work as well.
Google UTM Campaign Tracking in AMP amp-analytics
433 Views Asked by Bill Zheng At
1
There are 1 best solutions below
Related Questions in GOOGLE-ANALYTICS
- Loading Google Analytics after the user consents to cookie usage
- Google Analytics doesnt register events when redirected in a second page
- Remix App - Error: Minified React error #418 / #423 - on Google Analytics gtag script
- Google Analytics 4 does not show data (realtime/debugview)
- Google Analytics API - requesting all deviceId for particular UTM-marker
- Firebase analytics data not accurate
- GA Preview Says Tags are Working on Ngrok But Not on Production?
- link_url is truncating URL after 100 character in GA4
- more_than_30_sec event in GA4 strange behavior
- Rest arguments not working for gtag setup
- Retrieve visitor's Google query, pass it to the URL parameters and collect it for analytics purposes
- how do i do to configure user consent in ngx-google-analytics?
- How do I create a GA4 report showing event count when the events have unique/custom names?
- Google Analytics API error - User does not have sufficient permissions for this profile
- Events transmitted through the Measurement Protocol with the user_id are not received in GA4
Related Questions in AMP-ANALYTICS
- AMP-Analytics and AdSense Triggers for GA4 Integration
- config AMP page with analytics
- Nextjs: how to integrate google analytics in amp pages
- How to track scroll depth of Facebook Pixel in AMP page using amp-analytics?
- Google Optimize installation on AMP page: Not verified
- React dangerouslySetInnerHTML breaks JSON config with & character
- How to dynamically show or hide html based on a server's response
- How to make AMP HTML cookies UUID version 4 compliant
- Google UTM Campaign Tracking in AMP amp-analytics
- Google Ads Conversion Tracking only firing on some Leads from AMP HTML
- amp analytics missing pageviewId64
- Google Analytics on AMP-Pages without cookies
- AMP Audio: Track Play/Pause/Complete and Capture in Google Tag Manager
- (gtag) for AMP No triggers were found in the config. No analytics data will be sent
- Fire google amp-analytics event in an amp page when amp-form submit success
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
After some further digging, this problem solved. Here is how to solve the issue.
When a request comes in with
?utm_campaign=some_value&utm_medium=some_value&utm_source=some_value, it probably not the actual linkamp-analyticssend to GA. Actually it is sending thepage_locationin theamp-analyticsconfiguration.So if your configuration is like this:
{"vars": {"gtag_id":"UA-XXXX-0", "config": {"UA-XXXX-0": {"page_title":"some_value","page_location":"$urlWithParams"}}}}, e.g. current page location is https://example.com/ , then thepage_locationshould be like https://example.com/?utm_campaign=some_value&utm_source=some_value&utm_medium=some_value , then it will capture the UTM values. To achieve this, you can either get the current window location or url params using AMP url variables.