Closed Bug 1015092 Opened 10 years ago Closed 10 years ago

Tracking referrer ID from new landing pages and sites

Categories

(Webmaker Graveyard :: Metrics, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adam, Assigned: cade)

References

Details

(Whiteboard: [metrics] [June13])

Attachments

(3 files)

Much of the traffic for Maker Party is going to be directed to party.webmaker.org, events.webmaker.org, or static landing pages hosted by unbounce (on a TBC webmaker.org subdomain)

1) Am I right in thinking that right now, these sites are not setup to capture the ref ID parameter and therefore wouldn't be tracked properly?

2) As these are on the webmkaker.org domain, does this just need the cookies set correctly on these new pages?

3) If so, should we try and modularize the cookie-setting code so we can quickly add it to new subdomains as they get added in the future?
If these pages have Webmaker Login, they automatically support RIDs.

If not, I wrote a small cookie library: https://github.com/cadecairos/cookie-js that is used by webmaker auth-client to set the cookie:

https://github.com/mozilla/webmaker-auth-client/blob/master/webmaker-auth-client.js#L15-L29

and

https://github.com/mozilla/webmaker-auth-client/blob/master/webmaker-auth-client.js#L60-L65
Priority: -- → P2
Whiteboard: [June13]
Is there a reason that the Maker Party site doesn't have Webmaker Login? 

I'm sure that the answer is, "There are dozens of reasons," and I realize the landing pages might make that less important, but it seems like good practice, no?
Depends on: 1018223
Depends on: 1018254
Status: NEW → ASSIGNED
It's not clear to me what the deliverable on this bug is.

Were is party.webmaker.org hosted / what's it built with?

For unbounce pages, are we green-lighting a javascript snippet that can read a RID and set a cookie on the webmaker.org domain? (These pages *must* be on a *.webmaker.org domain)
I spoke with jbuck, and here's what I understand we need:

a script, including the cookie-js code, which can detect and set a RID cookie on a webmaker.org domain.

I'll get this done today
Here it is! does this solve the problem at hand?

you can load the script in directly, or we can host this on a central cdn and load the script via a snippet that adds a script tag to the body.
Attachment #8434255 - Flags: review?(jon)
Attachment #8434255 - Flags: feedback?(adam)
I might not be following. If we run this script on party.webmaker.org, we'll be able to track RIDs that lead to it?

If so, that is rad. And do I file a separate ticket to add the script to party.webmaker.org?
Chris, would this allow other sites to be able to use RIDS?  So for example training.webmakerprototypes.org?

Or potentially makes on makes.org if we put in the make valet?
(In reply to hannah from comment #6)
> I might not be following. If we run this script on party.webmaker.org, we'll
> be able to track RIDs that lead to it?

Yes, having this script load on party.webmaker.org will capture any rid that is set on the url's querystring, and if the user signs up for an account, we'll capture that referrer id.

> If so, that is rad. And do I file a separate ticket to add the script to
> party.webmaker.org?

Yes, lets file another ticket. Can you add this ticket as a blocker? We still have to figure out deployment to the CDN for this script.

 
(In reply to Brett Gaylor [:brett] from comment #7)
> Chris, would this allow other sites to be able to use RIDS?  So for example
> training.webmakerprototypes.org?
>
> Or potentially makes on makes.org if we put in the make valet?

No, Loading this script on a *.webmakerprototypes.org domain will only set a referrer cookie on the webmakerprototypes.org domain, which is unreadable to webmaker.org.
We can do RIDs for webmakerprototypes and makes.org with third-party cookies...

Basically we set up a route on webmaker.org - "/rid" - for example. A third party page (i.e. discourse.webmakerprototypes.org) can be told to load it as the source for an image tag. The url for the image tag can have a querystring like "?ref=referrerid_string", which tells the webmaker.org server to send a Set-Cookie header with the response image (probably a 1px by 1px png or something) that tells the browser to set a RID cookie for webmaker.org

pros: works cross domain, fairly simple
cons: third party cookies... which won't work if users disable them. (Safari does by default iirc)
Blocks: 1020535
jbuck: what do we have to do to get this script auto-deploying to stuff.webmaker.org?
Flags: needinfo?(jon)
Take a peek at https://github.com/mozilla/makerstrap/blob/master/.travis.yml for ideas, adding that logic should probably be a separate ticket
Flags: needinfo?(jon)
(In reply to Chris DeCairos (:cade) from comment #5)
> Created attachment 8434255 [details]
> https://github.com/cadecairos/webmaker-rid
> 
> Here it is! does this solve the problem at hand?

That's fantastic!
Comment on attachment 8434255 [details]
https://github.com/cadecairos/webmaker-rid

me gusta. Lets get this moved over to Mozilla, and add a travis deployment script before we use it anywhere though
Attachment #8434255 - Flags: review?(jon) → review+
Whiteboard: [June13] → [metrics] [June13]
@ Status?
Flags: needinfo?(cade)
Jon and I will get this out on the CDN today
Flags: needinfo?(cade)
Attachment #8437903 - Flags: review?(cade) → review+
You can now access the script at https://stuff.webmaker.org/webmaker-rid/webmaker-rid.js . I'll write up some usage instructions, and then we're set!
Some embedding instructions
Attachment #8437919 - Flags: review?(cade)
Attachment #8437919 - Flags: review?(cade) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
No longer depends on: 1018223
No longer depends on: 1018254
Blocks: 1018223
Attachment #8434255 - Flags: feedback?(adam)
This is very cool, but I tried this on an unbounce page and the cookie only seems to get set occasionally. I tried and failed to work out what might be causing this, but here's a screencast of what I'm talking about:
https://www.youtube.com/watch?v=MxyX8MGH47k&feature=youtu.be

The test page in that is here: 
http://welcome.webmaker.org/firefox-snippet-test-landing-page/

Is this something obvious, or should I file this as a separate bug?
Status: RESOLVED → REOPENED
Flags: needinfo?(jon)
Flags: needinfo?(cade)
Resolution: FIXED → ---
Hmmm... this works fine on makerparty, but its something weird on the unbounce page. Might be something to do with their CDN and/or publishing workflow.

I'll see if I can find a way to make it work now but will leave the ticket open in case you have any ideas.
OK, I think I've solved it. 

Basically, this landing page is really simple so loads quickly (ie quicker than the async loading of the RID script). This means that most of the time the "document.addEventListener("DOMContentLoaded", function()..." is getting called after the DOM content has been loaded, so doesn't execute.

If I remove 'async' from the embed script, and place this before the </body> it sets the cookie every time I hit the page.

It might be worth modifying the RID script to cope with that though, as loading it async is much nicer, and otherwise we might be leaking a % of tracking.

If you agree, I can file that as a separate ticket, and close this one again.
(In reply to Adam Lofting (:adamlofting) from comment #23) 
> It might be worth modifying the RID script to cope with that though, as
> loading it async is much nicer, and otherwise we might be leaking a % of
> tracking.
> 
> If you agree, I can file that as a separate ticket, and close this one again.

Yeah, file that as a new ticket and we can updated the RID script.
Flags: needinfo?(cade)
Blocks: 1024559
Filed bug 1024559 to fix this.
Flags: needinfo?(jon)
re-closing this sucker
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: