Skip to content
This repository has been archived by the owner on Aug 10, 2020. It is now read-only.

Cto 222 mixpanel gdpr #90

Open
wants to merge 83 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
e8b7b45
remove examples
Oct 8, 2012
050e513
remove session command store
Oct 8, 2012
c2e5ad1
Make javascript_helpers mandatory
Oct 8, 2012
2842dfc
Channel events through flash instead of rendering them to the page.
Oct 8, 2012
7e6e30a
forgot to update gemspec
Oct 8, 2012
5e0df9a
add middleware
Oct 10, 2012
432106a
don't log options in a separate line
Oct 10, 2012
07f3b0a
explicitly require the middleware
Oct 10, 2012
fc6e99c
update mixpanel module
Oct 10, 2012
53958ba
re-add support for commands other than event
Oct 11, 2012
5273954
support google in the new style commands
Oct 11, 2012
6cc6676
fix middleware cookie handling
Oct 11, 2012
d489ab5
modernize crazy_egg include
Oct 16, 2012
6c24f75
Fix google event tracking value
Jan 25, 2013
e30354d
fix js decoding
Feb 27, 2013
b54806b
Support Display Advertiser
Nov 26, 2013
8c3b309
solve jquery deprecation warning
Feb 22, 2014
779cf9c
Update mixpanel implementation
Mar 25, 2014
7a99822
Merge pull request #1 from pedrocarrico/master
dsgh Mar 26, 2014
f1eaf46
Update google analytics to the new Universal Analytics version
Apr 30, 2014
62cedd3
Merge pull request #2 from pedrocarrico/master
dsgh May 6, 2014
db380aa
Add alias identity to mixpanel module
May 8, 2014
2d73feb
Merge pull request #3 from pierreozoux/master
dsgh May 9, 2014
9236c46
Fix arguments' order for google analytics tracking method.
andr3 Jun 19, 2014
070cb84
Merge pull request #4 from andr3pt/ga-events-not-configured-properly
dsgh Jun 19, 2014
77f87dd
minor: correctly indent output
Jun 30, 2014
2bb0a66
Google: support optional linkid
Jun 30, 2014
8c3c2ea
send event action as string "undefined" when action is not defined
Jul 7, 2014
598a73a
Merge pull request #5 from telmofcosta/master
dsgh Jul 9, 2014
1adb350
Add sift science module
Mar 31, 2015
be515b5
Merge pull request #6 from marionzualo/master
dsgh Mar 31, 2015
a324f41
Upgrade jquery Cookie to js cookie
Jun 9, 2015
50520db
Merge pull request #7 from pedrocarrico/upgrade-to-js-cookie
dsgh Jun 9, 2015
f861c5f
Disable robot checking
Dec 7, 2015
a5714be
Merge pull request #8 from sergiopatricio/master
dsgh Dec 7, 2015
5fce5c3
Add Google Tag Manager module
Dec 9, 2015
89dbc59
Merge pull request #9 from sergiopatricio/google-tag-manager
dsgh Dec 10, 2015
6ca6056
Cleanup track in mixpanel
Jan 6, 2016
70699ca
Enable track (page-view events) javascript
Jan 6, 2016
07619ef
Configure track (page-view events) for google
Jan 6, 2016
bd414dc
Merge pull request #10 from sergiopatricio/track
dsgh Jan 7, 2016
290b184
Enable identify option for google module
Jan 7, 2016
8fc692f
Merge pull request #11 from sergiopatricio/google-identify
dsgh Jan 8, 2016
7d659c6
Allow to send custom dimensions with google track
Jan 19, 2016
eac462a
Merge pull request #12 from sergiopatricio/google-track-with-options
dsgh Jan 29, 2016
5ee4891
Properly enable identify option for google module
Feb 2, 2016
e83a2a4
Merge pull request #13 from sergiopatricio/ga-identify-fix
dsgh Feb 2, 2016
393ccfa
Integrate GA and Optimizely
Apr 13, 2016
6b02e25
Merge pull request #14 from marionzualo/mix-opt
dsgh Apr 13, 2016
d007975
Track events in intercom
May 13, 2016
83d827a
Merge pull request #15 from marionzualo/intercom
dsgh May 13, 2016
5fb5ea6
Spelling fix
Jun 14, 2016
82b8d7c
Update intercom user after event track
Jun 14, 2016
202a8d1
Merge pull request #16 from telmofcosta/intercom-update-async-request
dsgh Jun 15, 2016
6a64ec1
Update mixpanel lib
Aug 22, 2016
a1ebeaa
Add reset method
Aug 22, 2016
cdf8774
Merge pull request #17 from Seedrs/add-reset-method
miguelfteixeira Aug 23, 2016
182139e
Fix mixpanel lib
Aug 23, 2016
b0f1010
Merge pull request #18 from Seedrs/fix-mixpanel-lib
miguelfteixeira Aug 24, 2016
16671d3
Update AdRoll code
Aug 31, 2016
1348b7f
Merge pull request #19 from Seedrs/update-adroll
Sep 1, 2016
7f6ec2e
Update adroll code again
Sep 1, 2016
7445db9
Check if intercom is defined before calling it
sergiopatricio Oct 28, 2016
af46f08
Merge pull request #20 from Seedrs/intercom-fix
sergiopatricio Oct 28, 2016
646c5f3
Add segment
Nov 15, 2016
f3be42f
Add the ability to track virtual page views
Nov 25, 2016
d23030e
Add url in segment track method
Nov 25, 2016
fc051a0
Merge pull request #21 from Seedrs/add-segment
nsorros Dec 12, 2016
a976fc0
Add options as a string in GA to be able to filter
Dec 16, 2016
837b9cf
Merge pull request #23 from Seedrs/ga-label-update
nsorros Dec 19, 2016
3ac663d
Remove intercom integration
Jan 10, 2017
8765758
Merge pull request #24 from Seedrs/remove-intercom
danielmag Jan 11, 2017
b01d941
Ignore referrer when cookie for that is present
Feb 9, 2018
71a065e
Merge pull request #26 from Seedrs/INV-1060-ignore-referrer
sergiopatricio Feb 12, 2018
5c7e628
Fix rails 5 deprecation
May 9, 2018
eb339cc
Implementing not track on Mixpanel
brizido May 24, 2018
2403cd9
Merge pull request #27 from Seedrs/CTO-222-mixpanel-gdpr
brizido May 24, 2018
11d6711
Fixing typo
brizido May 24, 2018
83224f3
Merge pull request #28 from Seedrs/CTO-222-mixpanel-gdpr
brizido May 24, 2018
d985771
Fixing issue where visitors where not being tracked
brizido May 31, 2018
9b9f868
Merge pull request #29 from Seedrs/CTO-222-mixpanel-gdpr
brizido May 31, 2018
2bb03e6
Fixing mixpanel tracking
brizido Jul 16, 2018
45a087a
Merge branch 'master' into CTO-222-mixpanel-gdpr
brizido Jul 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Add the following to your controllers:

analytical

Add the middleware configuration in config/application.rb:

config.middleware.use Analytical::Middleware

Add a configuration file (config/analytical.yml) to declare your API keys, like so:

production:
Expand All @@ -53,7 +57,6 @@ Then, in your template files, you'll want to add the analytical helper methods f
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
<% analytical.identify '5', :email=>'[email protected]' %>
<%= raw analytical.head_append_javascript %>
</head>
<body>
Expand All @@ -63,9 +66,13 @@ Then, in your template files, you'll want to add the analytical helper methods f
</body>
</html>

Note the example above also includes an identify() command that will apply to every page. More likely, you'll want to make this identify() command conditional so that it only applies when you have a logged-in user:
You'll want to add the identify() command as a before_filter:

<% analytical.identify(current_user.id, :email=>current_user.email) if current_user %>
before_filter :analytical_identify
protected
def analytical_identify
analytical.identify(current_user.id, :email => current_user.email) if current_user
end

You can sprinkle the track() and event() tracking methods throughout your views & controllers as needed.

Expand Down Expand Up @@ -93,21 +100,6 @@ This can be useful for enabling the console logger optionally in your app, based

New modules should be fairly easy to add. Follow the structure that I've used in the Clicky, Google, and KISSMetrics modules... and you should be fine. All modules should include the Analytical::Base::Api module, so that they have some default behavior for methods that they don't support or need.

== Session-based command queues

By default, any Analytical commands that are queued in a controller that subsequently redirects won't be emitted to the client. This is because the redirect triggers a new request, and everything is cleared out at the beginning of each request.

However, if you would like to be able to queue commands between requests... there's a new option that supports this behavior:

analytical :modules=>[:console, :google], :use_session_store=>true

This will store the queued commands in the user session, clearing them out when they are emitted to the client, but allowing you to make calls like:

analytical.track 'something'

... in your controller. After a redirect, the corresponding track() call will be emitted in the next request made by the client.
NOTE: This is new and somewhat experimental, and could cause problems if you store large amounts of data in the session. (there is a 4k limit to session data)

== Javascript tracking/event commands

Sometimes you want to trigger an analytics track/event via javascript. Analytical now provides a solution for this by default. Appended to your <head> is a simple javascript object that will contain "instantaneous" versions of the tracking commands for each of your modules.
Expand All @@ -119,10 +111,6 @@ You call these analytical commands like this:

When you call these commands, it will pass the track/event name & data on to each of the modules. (Take a look at the simple javascript helpers in your <head> for more information.)

To disable this functionality, use

analytical :javascript_helpers => false


== Note on Patches/Pull Requests

Expand Down
1 change: 0 additions & 1 deletion analytical.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Gem::Specification.new do |s|
"lib/analytical/modules/quantcast.rb",
"lib/analytical/modules/reinvigorate.rb",
"lib/analytical/rails/engine.rb",
"lib/analytical/session_command_store.rb",
"rails/init.rb"
]
s.homepage = %q{http://github.com/jkrall/analytical}
Expand Down
20 changes: 20 additions & 0 deletions app/views/application/_analytical_fire_events.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script type="text/javascript">
var commands;

try {
commands = $.parseJSON(decodeURIComponent((Cookies.get('analytical') || '').replace(/\+/g, '%20')) || '[]');
} catch(e) {
commands = [];
}

Cookies.remove('analytical', { path: '/' });

$.each(commands, function(index, command) {
var method = command.shift(),
arguments = command;

if ('function' === typeof Analytical[method]) {
Analytical[method].apply(this, arguments);
}
});
</script>
21 changes: 16 additions & 5 deletions app/views/application/_analytical_javascript.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<script type="text/javascript">
var Analytical = {
track: function(page) {
<%= raw analytical.now.track('__PAGE__').gsub(/"__PAGE__"/,'page') %>
identify: function(id, options) {
<%= raw(analytical.javascript_for.identify.gsub(/^/, " " * 4).strip) %>
},
event: function(name, data) {
if (typeof data === 'undefined') { data = {}; }
<%= raw analytical.now.event('__EVENT__', {}).gsub(/"__EVENT__"/,'name').gsub(/"?\{\}"?/,'data') %>
track: function(page, options) {
<%= raw(analytical.javascript_for.track.gsub(/^/, " " * 4).strip) %>
},
event: function(name, options, callback) {
<%= raw(analytical.javascript_for.event.gsub(/^/, " " * 4).strip) %>
},
set: function(properties) {
<%= raw(analytical.javascript_for.set.gsub(/^/, " " * 4).strip) %>
},
reset: function(properties) {
<%= raw(analytical.javascript_for.reset.gsub(/^/, " " * 4).strip) %>
},
alias_identity: function(old_identity, new_identity) {
<%= raw(analytical.javascript_for.alias_identity.gsub(/^/, " " * 4).strip) %>
}
};
</script>
4 changes: 0 additions & 4 deletions example/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions example/rails2.3/Gemfile

This file was deleted.

38 changes: 0 additions & 38 deletions example/rails2.3/Gemfile.lock

This file was deleted.

Loading