Skip to content

Instantly share code, notes, and snippets.

@osecluna
Created March 12, 2015 11:08
Show Gist options
  • Save osecluna/4219da239f70901a0d29 to your computer and use it in GitHub Desktop.
Save osecluna/4219da239f70901a0d29 to your computer and use it in GitHub Desktop.
filter impressions from datalayter
dataLayer = dataLayer.filter (function (el) {
/* Clean up datalayer so there are not multiple impressions objects */
if (el.ecommerce) {
return !el.ecommerce.impressions;
} else {
return el;
}
});
@andywillis
Copy link

You don't need the else:

dataLayer = dataLayer.filter (function (el) {
  /* Clean up datalayer so there are not multiple impressions objects */
  if (el.ecommerce) {
    return !el.ecommerce.impressions;
  }
  return el;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment