Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Ryan sryan-mp

  • mParticle
View GitHub Profile
View mpContentDownloaded
mpContentDownloaded() {
if (window.mParticle) {
const URL = window.location.href.toString();
const {utm_campaign, utm_medium, utm_source, utm_content, utm_term} = null;
if (window.location.search) {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
urlParams.utm_campaign ? utm_campaign = urlParams.get('utm_campaign') : null;
View ShareLinks.js
View analytics.js
import React from 'react';
import ReactGA from 'react-ga';
import isJson from 'utils/isJson';
export default class Analytics {
constructor(args) {
Object.assign(this, args);
this.scripts = scripts(args);
}
View gist:fc8e1254801f1055a5e3b2416ae08645
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { gaPageView, mpPageView, mpFormSubmitted, mpContentDownloaded } from 'utils/analytics';
export default class Analytics extends PureComponent {
static propTypes = {
location: PropTypes.object,
};
componentWillReceiveProps(newProps) {
View gist:15bd9aa8cf84d7a3c6edd208ada3ef0c
import React, { Component } from 'react';
import { RichText, Link } from 'prismic-reactjs';
import Button from 'components/button';
import SlicePropType from 'utils/slice-prop-type';
import slugify from 'utils/slugify';
import linkResolver from 'utils/prismic-link-resolver';
import mpContentDownloaded from 'utils/analytics';
import * as s from './SidebarButton.module.scss';
export default class SidebarButton extends Component {
View gist:ecb09ecfb4e3bd8274ceee4d80d8a0b3
export const query = graphql`
query($id: String!) {
prismicArticle(id: { eq: $id }) {
_previewable
id
uid
type
data {
article_collection
article_type