Search code examples
google-tag-managermixpanel

Is Google Tag Manager sending extra events to Mixpanel through a proxy?


I configured GTM to load Mixpanel on every page on my domain and added click tracking on buttons like described on this blog: https://mixpanel.com/blog/2015/03/27/community-tip-implementing-mixpanel-via-google-tag-manager

This is not deployed to any server yet, just localhost, but it seems whenever clicks are being tracked, I get bogus events in mixpanel coming from the US on this url: https://gtm-msr.appspot.com/render2?id=GTM-XXXXX with this user agent: Mozilla/5.0 (Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; EIE10;ENUSWOL; rv:11.0) like Gecko

Anyone encountered this before? Any idea's what is happening here?


Solution

  • As a workaround I added a check in the mixpanel tracking code in GTM to filter out the bogus user agent. Of course, this works for now, until they change the user agent.

    <script type="text/javascript">
      if (navigator.userAgent != 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; EIE10;ENUSWOL; rv:11.0) like Gecko') {  
        var pagePath = {{Page Path}};
        mixpanel.track("Page Loaded", {"Page Path": pagePath, "User Agent": navigator.userAgent});
      }
    </script>
    

    Adding a filter in GTM itself doesn't work either, GTM ignores it.