-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add :custom_vars option #20
Conversation
Hi there, we recently ran into this issue as well. It seems both @bgarret Do you have any intentions to accept this pull request and make a release? Do you need any help maintaining the library? Can I help at all? |
I wont merge this as-is because (as @paracycle said) some events need to bet set before and some need to be set after A better solution in this case would be to add a new option (say Regarding the maintenance of the library, I have indeed not touched it for a long long time. I'm not using Rails anymore and I don't really follow the developments of Google Analytics. If you want to lend a hand, I have given you full access to the repo. For the releases, I'll need a rubygems username to be able to add you as an owner. Thanks for the patience. |
@bgarret Thank you, I will start working on the current issues and make a release. My rubygems username is "ufuk". @yonda Could you update your pull-request so that before events and after events are properly accounted for in backwards compatible manner? If you can't, please let me know, so that I can start working on it myself. Thanks. |
@paracycle Done, you should be able to push releases on rubygems. I'm using the following (rough) release process :
I'm not particularly attached to the process but I find it simple and efficient. Feel free to make changes as you see fit. |
@paracycle I will be able to update my PR in a few days so that before events and after events are properly accounted for in backwards compatible manner. Please wait until this PR is merged if possible. @bgarret Thank you, my rubygems username is "yonda". Can you add to the owner ? |
@yonda Sure, I'll be waiting on an update from you. |
@yonda I've added you as an owner on rubygems and a collaborator on github. Let me know if I can do anything. |
@paracycle @bgarret What do you think? I am glad if I get your advice. |
@yonda I guess it would be best to just turn this PR into a change that adds a This is what I have in mind: # application.html.erb
...
<%= analytics_init custom_vars: [
GA::Events::SetCustomVar.new(1, 'test_group', 'black', 1),
GA::Events::SetCustomVar.new(2, 'cohort', '2014-02', 1)
]
%>
...
# lib/google-analytics/rails/view_helpers.rb
...
events.unshift GA::Events::TrackPageview.new(options[:page])
(options[:custom_vars] || []).each do |custom_var|
events.unshift custom_var
end
... What do you think? |
@paracycle 👍 for this, I like the fact that it preserves the GA semantics and does not force the implementer to guess whether the call should go before or after |
Hi guys, how soon do you think the :custom_vars PR will be added? This is currently the exact problem that is keeping me from using this gem. I'm happy to do it if @yonda or @paracycle don't. |
@paracycle @bgarret Thank you for your advice ! |
@yonda 👍 |
@yonda This seems great, thanks. The Travis build does not pass but that is related to a problem with the Rubinius build, so I am merging this. |
Hello!
In the case of using
analytics_init
method, if you add additional events byadd_events
option, it is set after that_trackPageview
request.However, for example, as is described in the Google Analytics Documents, we need to set "_trackPageview()" request after setting a custom variable.
(In my applications, _setCustomVar option has not been reflected in the Google Analytics.)
So, I changed the order in which additional events setting.
After change the order, _setCustomVar option has been reflected in the Google Analytics.
What do you think?
Thanks!