Using in-house/custom Analytics causes JavaScript Errors
-
Using Google analytics (or, indeed, any of the “published” analytics types) works fine.
But it is also possible to use your own, in-house analytics by putting a blank space in the “Type” field. The problem is, that puts a blank “type” entry in the opening tag:
<amp-analytics id="123456789" type class="i-amphtml-layout-fixed i-amphtml-layout-size-defined" style="width:1px;height:1px;" i-amphtml-layout="fixed">
And the problem with that is by simply having
type
in there at all, it’s parsed as though an external vendor’s transport settings are there, meaning if you add a “transport” tag (as you would want to do with your own in-house analytics), it throws an AmpAnalytics javascript error: “inline or remote config should not overwrite vendor transport settings”.My suggestion: if “Type” is left blank on the config screen, let it be a valid submission and then, in those cases, don’t add “type” to the script call at all. This is consistent with the AMP developers’ guidelines.
Thanks!
- The topic ‘Using in-house/custom Analytics causes JavaScript Errors’ is closed to new replies.