Errors: _isMatchingDomain is not defined and DataCloneError


#1

I am getting a lot of errors coming through.
Errors coming from Windows Computers.

Browsers :
Edge 17.17134
Chrome 69.0.3497
Chrome 68.0.3440
Chrome 40.0.2214

ReferenceError: _isMatchingDomain is not defined
  at parseCookie(/islandhomeessentials:1:32577)
  at HTMLDocument.set [as cookie](/islandhomeessentials:1:32577)
  at Object.cookie(/2.9.2/sp.js:9:568)
  at Object.d.findRootDomain(/2.9.2/sp.js:9:29759)
  at new j(/2.9.2/sp.js:9:54262)
  at p(/2.9.2/sp.js:9:23497)
  at r(/2.9.2/sp.js:9:23877)
  at new d.InQueueManager(/2.9.2/sp.js:9:24081)
  at new e.Snowplow(/2.9.2/sp.js:9:51660)
  at Object.16../snowplow(/2.9.2/sp.js:9:24326)
  at d(/2.9.2/sp.js:9:267)
  at a(/2.9.2/sp.js:9:439)
  at ? (/2.9.2/sp.js:9:468)

Header

Referer | https://www.facebook.com/
User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134

Also getting a lot of DataCloneError messages from same browsers above and Window computers.

DataCloneError: Failed to execute 'postMessage' on 'Window': function (a){if(Ce.ab.hasOwnProperty(a))return Ce.ab[a]} could not be cloned.
  at _reportEvent(/pabkins:1:32529)
  at eval(/pabkins:1:32529)
  at eval(/pabkins:1:32529)

I have looked everywhere and cannot reproduce the error. Think this could be related:

Note: I am also using es6 Array.from with core.js.

here is the bit of code:

on the header

    <!-- Snowplow Tag Manager -->
    <script type="text/javascript">
    ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
    p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
    };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
    n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.9.2/sp.js","snowplow"));
    window.snowplow('newTracker', 'cf', 'xxx', { 
      appId: 'xxx',
      discoverRootDomain: true
    })
    </script>
    <!-- End Snowplow Tag Manager -->

In the service.js
below are initiated through dom ready.

const snowplowPageView = {
  getAttr : () => {
    let data = {
      accountId : '',
      userId: '',
      subscription: ''
    }
    if(window.data) {
      data = {
        accountId    : window.data.profile_id ||  '',
        userId       : window.data.user_id || '',
        subscription : window.data.profile_subscription || ''
      }
    }
    return data
  },
  getPageType: () => {
    function bodyHasClass(classname) {
      return document.querySelector('body').classList.contains(classname)
    }

    let pageType = ''
    switch(true) {
      case bodyHasClass('site') :
        pageType = 'info'
        break
      case bodyHasClass('admin') :
        pageType = 'admin'
        break
      case bodyHasClass('service') :
        pageType = 'profile'
        break
      default :
        pageType = ''
        break
    }
    return pageType
  },
  init : () => {

    const pageViewAttr = snowplowPageView.getAttr()

    const  sp = {
      event : 'trackPageView',
      schema : 'iglu:com.pageview/jsonschema/1-0-0',
      data : {
        user_id: pageViewAttr.userId,
        profile_id: pageViewAttr.accountId,
        profile_subscription: pageViewAttr.subscription,
      }
    }

    const pageType = snowplowPageView.getPageType()
    if( pageType ) {
      sp.data.page_type = pageType
    }

    window.snowplow(sp.event, null, [{ schema: sp.schema, data: sp.data }])

    //If userid
    if (pageViewAttr.userId) {
      window.snowplow('setUserId', pageViewAttr.userId)
    }
  }
}

const snowplowProfileLinksClicked = {
  class :  'a.btn-link, a.user-profile__social__links__item, .newsletter-form label',
  linkElms : () =>  document.querySelectorAll(snowplowProfileLinksClicked.class),
  getLinkAttr : element => {
    return {
      id      : element.getAttribute('data-link-id') || "0",
      url     : element.getAttribute('href') || '',
      type    : snowplowProfileLinksClicked.getType(element)
    }
  },
  getType : element => {
    let output = ''
    switch(true) {
      //Prority Link
      case element.classList.contains('btn-link') &&
        element.value && element.value.includes('animate') :
        output = 'priority'
        break
      //Nomal Link
      case element.classList.contains('btn-link') :
        output = 'button_link'
        break
      //Email
      case element.tagName === 'LABEL' :
        output = 'email_capture'
        break
      //Social
      case element.classList.contains('user-profile__social__links__item') :
        output = 'social_icon'
        break
      //Default
      default :
        output = ''
        break
    }
    return output
  },
  init: () => {
    Array.from(snowplowProfileLinksClicked.linkElms()).forEach(link => {
      link.addEventListener('click', event => {
        let linkAttr = snowplowProfileLinksClicked.getLinkAttr(event.target)
        const  sp = {
          event : 'trackSelfDescribingEvent',
          schema : 'iglu:com.****/profile_link_clicked/jsonschema/1-0-0',
          data : {
            link_id: linkAttr.id,
            link_destination: linkAttr.url,
            link_type: linkAttr.type
          }
        }
        window.snowplow( sp.event, { schema: sp.schema, data: sp.data });
      })
    })
  }
}

Your help would be much appreciated


#2

Is the traffic coming from a Facebook owned IP? It sounds like other people have had other issues related to Facebook crawlers executing JS code.


#3

Filtering out the facebook ips did the trick. For anyone having the same problem I put the following ips to be whitelisted

31.13.24.0/21
31.13.64.0/18
66.220.144.0/20
69.63.176.0/20
69.171.224.0/19
74.119.76.0/22
103.4.96.0/22
173.252.64.0/18
204.15.20.0/22

#4

Thanks @mike for the suggestion