add tracking code and stuff to station widget #187

brianboyer opened this Issue Jan 17, 2013 · 5 comments


None yet
3 participants

brianboyer commented Jan 17, 2013

from aly:

so here's an example (look at the 2nd widget):

we give stations a bit of code that includes a bit of js

that js has all the tracking code, and does a document.write to iframe in the widget:

(this is probably not the most elegant way to do it. it predates me.)

there are 2 things you need to change in the js:

the ref to the iframe, and this line:

'<script type="text/javascript">window.vsitag = {"imp":"npr_election_2012_widget"};</script>',

change npr_election_2012_widget to something more appropriate

whatever you want it to be

@onyxfish onyxfish added a commit that referenced this issue Jan 18, 2013

@onyxfish onyxfish Add widget tracking js. #187. bce8070

onyxfish commented Jan 18, 2013

Done, with three open questions:

  1. Are we going to allow member stations to disable the audio player like we did with election night?
  2. The tracking code in this snippet ends in -3, but our usual one ends in -12. I assume this is the one. Do we want it that way?
  3. Does this have to be hosted on, or can we just deploy it with our usual rig and give them an url?

brianboyer commented Jan 18, 2013

  1. I have received no requests for this, so, no.
  2. No idea.
  3. No idea.

alykat commented Jan 18, 2013

  1. Inaug widget doesn't have that feature -- everything points to the app this time. Can remove the audio bit from the station embed code.

  2. You could check with Jeff Nemic, but I'd just leave it. I suspect it's a separate Member and Program Services analytics acct.

  3. Double check that the .js file isn't dependent on anything on www. I suspect it would be fine living on apps.


onyxfish commented Jan 18, 2013

Here is the code to embed the widget:

<script type="text/javascript">
    nprInaugurationWidth = 960;
    nprInaugurationHeight = 230;
<script type="text/javascript" src=""></script>

Default size is 300x500 if not provided.


onyxfish commented Jan 18, 2013

@alykat Awesome. The only www dependency is this bit of javascript:

But it should be fine to just pull that cross-domain. (It's working now.)

Closing this now.

onyxfish closed this Jan 18, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment