but I may found a bug when it run with google analytics.
options.analytics() didn't have any param. so ga("send", "pageview", {"page": options.url, "title": options.title}) got an error Cannot read property 'url' of undefined.
I fixed it by replaced with ga("send", "pageview", {"page": location.pathname, "title": document.title}).
thank you for this great pjax.
but I may found a bug when it run with google analytics.
`options.analytics()` didn't have any param. so `ga("send", "pageview", {"page": options.url, "title": options.title})` got an error `Cannot read property 'url' of undefined`.
I fixed it by replaced with `ga("send", "pageview", {"page": location.pathname, "title": document.title})`.
@coolhihi we are currently working on a new release 0.2.2. Perhaps when we do release it, you can test your stuff to see if this issue is still present?
@coolhihi we are currently working on a new release 0.2.2. Perhaps when we do release it, you can test your stuff to see if this issue is still present?
@coolhihi actually I suspect that the reason why it was removed was because you can easily do this by just adding a listener to document (pjax:complete) then firing the appropriate GA event. This would be the most appropriate thing to do as we cannot assume everyone is using Google Analytics.
@coolhihi actually I suspect that the reason why it was removed was because you can easily do this by just adding a listener to document (pjax:complete) then firing the appropriate GA event. This would be the most appropriate thing to do as we cannot assume everyone is using Google Analytics.
@MoOx @darylteo the HEAD version also have this bug. I had sent pull request. But I agree with darylteo the google analytics code is not necessary. Google may change the api in the future, and users can easily do this in pjax:complete or pjax:success. So I suggest to remove the code about google analytics.
@MoOx @darylteo the HEAD version also have this bug. I had sent pull request. But I agree with darylteo the google analytics code is not necessary. Google may change the api in the future, and users can easily do this in `pjax:complete` or `pjax:success`. So I suggest to remove the code about google analytics.
I have this bug too. I solve this problem with custom analytics function like this:
``` javascript
new Pjax({
analytics: function () {
window.ga('send', 'pageview', {page: document.location.pathname, title: document.title})
}
})
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
thank you for this great pjax.
but I may found a bug when it run with google analytics.
options.analytics()didn't have any param. soga("send", "pageview", {"page": options.url, "title": options.title})got an errorCannot read property 'url' of undefined.I fixed it by replaced with
ga("send", "pageview", {"page": location.pathname, "title": document.title}).@coolhihi hi can you tell us which version of pjax you are using?
@darylteo v0.1.4
I get it by
npm install pjax@coolhihi we are currently working on a new release 0.2.2. Perhaps when we do release it, you can test your stuff to see if this issue is still present?
@darylteo Thank you. I can only got 0.2.1 by npm. Is the master HEAD 0.2.2? Or which way I can get 0.2.2?
@coolhihi You will need master HEAD. 0.2.1 is broken and will not work.
@darylteo I found that google analytics was removed in new version. But that's okay, I will add it myself. thanks
Please PR =)@coolhihi actually I suspect that the reason why it was removed was because you can easily do this by just adding a listener to document (pjax:complete) then firing the appropriate GA event. This would be the most appropriate thing to do as we cannot assume everyone is using Google Analytics.
We should at least add doc for this, so I am reopening.
@MoOx @darylteo the HEAD version also have this bug. I had sent pull request. But I agree with darylteo the google analytics code is not necessary. Google may change the api in the future, and users can easily do this in
pjax:completeorpjax:success. So I suggest to remove the code about google analytics.I have this bug too. I solve this problem with custom analytics function like this:
Closed by #59