Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

No hit detected #332

Closed
francisrod01 opened this issue Jan 7, 2019 · 1 comment
Closed

No hit detected #332

francisrod01 opened this issue Jan 7, 2019 · 1 comment

Comments

@francisrod01
Copy link

francisrod01 commented Jan 7, 2019

Since last month I don't receive none hit even using my own IP as a filter.
What's going on?

No hit
First detected: Dec 24, 2018 13:01:15
xxxxx property is not getting hits. The site is not receiving sessions or is not coded correctly.

Google Tag wizard recordings can help you verify that your site is coded correctly.

There's my App.js component below:

  render() {
    const { site_url } = this.props;
    const appProps = {};

    if (isServer) {
      appProps.site_url = site_url;
    } else {
      appProps.site_url = window.location.origin;
    }

    return <RouteApp {...appProps} />;
  }
}

let App = RootApp;

if (process.env.NODE_ENV === "production") {
  import("./with-analytics").then(
    withAnalytics => (App = withAnalytics.default(RootApp))
  );
}

const mapStateToProps = state => ({
  isAuthenticated: state.sessionUser.isAuthenticated
});

const mapDispatchToProps = dispatch =>
  bindActionCreators({ checkUserSessionRequest }, dispatch);

export default withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(App)
);

I tried to change it but not success:

const withAnalytics = async (Component) => {
  let App = Component;

  if (process.env.NODE_ENV === "production") {
    await import("./with-analytics").then(ga => (App = ga.default(RootApp)));
  }

  return App;
};


const mapStateToProps = state => ({
  isAuthenticated: state.sessionUser.isAuthenticated
});

const mapDispatchToProps = dispatch =>
  bindActionCreators({ checkUserSessionRequest }, dispatch);

export default withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(withAnalytics(RootApp))
);
@francisrod01
Copy link
Author

francisrod01 commented Jan 7, 2019

I'm just using the sample now BUT I changed the Analytics' initialize and using the import of with-analytics.js normally without import/then(). and without if / production.

https://github.com/react-ga/react-ga/wiki/React-Router-v4-withTracker#code

Changing an one line:

const gaInit() => {
  GoogleAnalytics.initialize("UA-0000000-0");
}

...

const withTracker = (WrappedComponent, options = {}) => {
  gaInit();

  const trackPage = page => {
    GoogleAnalytics.set({
      page,
      ...options,
    });
    GoogleAnalytics.pageview(page);
  };
...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant