Google tag manager not working on IOS
See original GitHub issueThe configuration for the tag manager was done by adding something like the following to the index.html of the project:
<!-- Global Site Tag (gtag.js) - Google AdWords: GOOGLE_CONVERSION_ID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-GOOGLE_CONVERSION_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-GOOGLE_CONVERSION_ID');
</script>
Debugging the issue the apparently reason that it isn’t working is because when an event is triggered, the app makes a GET request to https://www.google-analytics.com/collect
, but on the iOS build inspected through the Safari develop console, that request is never made.
Also, when opening the page from the Safari browser it’s working as expected.
The versions are:
“@capacitor/core” : “^1.0.0-beta.17”
“@capacitor/ios”: “^1.0.0-beta.19”
“@capacitor/cli”: “^1.0.0-beta.19”
Testing from an iPhone 6 running IOS 11.4.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:45 (4 by maintainers)
Top Results From Across the Web
Google Tag Manager for iOS
Sign in to your Tag Manager account. · Click ADMIN in the top navigation bar. · On the CONTAINER column, click the drop-down...
Read more >Google tag manger for ios not loading container - Stack Overflow
I am trying to add google tag manager in my xcode project which will track firebase events in ios. I've created a tag...
Read more >GTM for iOS: Can't load default container - Issue Tracker
We were using the export function in Google Tag Manager to get the default container. The saved exported file was for some reason...
Read more >Google Tag Manager for iOS - Braze
This article covers how to initialize, configure, and implement the Google Tag manager into your iOS app.
Read more >Set up and install Tag Manager - Google Support
4. Verify that your tags work · Click the Preview button. · Enter the website URL on which you installed the Tag Manager...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve managed to relay the
ga
settings from GTM by doing the following:Empty function
as aCustom Javascript
type with the following contents:JS - GetClientId
as aCustom Javascript
type with the following contents:JS - SetClientId
as aCustom Javascript
type with the following contents:Google Analytics Settings
type. Go toMore Settings > Fields to Set
.Field Name
tocheckProtocolTask
withValue
as{{Empty function}}
Field Name
tostorage
withValue
asnone
Field Name
tohitCallback
withValue
as{{JS - SetClientId}}
Field Name
toclientId
withValue
as{{JS - GetClientId}}
Essentially,
4.i
- removes the requirement for the URI protocol to be restricted tohttp
orhttps
.4.ii
,4.iii
,4.iv
- moves the GA client id to be stored on localStorage instead of in the cookie.Ok i’ve fixed