npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ra5mus/eb-comscore

v1.0.1

Published

Convenience wrapper for comscore functionality

Downloads

2

Readme

eb-comscore

How to interact with Comscore

These are the main steps to perform:

1. (mandatory) Initialize and configure comscore on page load.

Normally this is done via the <ebComscore:init /> taglib, which add a number of common parameters to the ebComscore object, including comscoreId, comscoreSite, comscoreVsite, comscoreSubVsite and comscoreString. Alternatively, call ebComscore.initializeComscore() and supply the needed parameters.

2. (optional) Track page view Often done via the <ebComscore:trackPageView /> taglib function, which generates both javascript and a <noscript><img> for browsers with javascript disabled. Alternatively, call ebComscore.sendComscorePageview() directly, and remember to handle browsers with javascript disabled.

3. (optional) Track event Can be done via the <ebComscore:jsForTrackingEvent /> taglib function, which generates javascript to put in ex. an onclick/onsubmit event handler. Alternatively, call one of the comscoreEvent() or ebComscore.sendComscoreNonPageview() javascript functions directly. Both options offer the opportunity to send along custom parameters to comscore.

4. (mandatory) Include comscore js before </body>

Normally this is done via the <ebComscore:bottom /> taglig, right before the end </body> tag. Alternatively, manually include http://b.scorecardresearch.com/c2/16785783/cs.js at the end of the body.

Javascript cheat-sheet

Refer to the source for more information. This is just a short sample

<!-- include javascript -->
<script src="http://ekstrabladet.dk/template/v5-6/shared/js/modules/comscore/comscore.js" type="text/javascript" />
<script src="http://ekstrabladet.dk/template/v5-6/shared/js/modules/comscore/ecommerce.js" type="text/javascript" />

<script>
  // initialize comscore on each page within the <head> section
  ebComscore.initializeComscore('16785783', 'jppol', 'ebmedier', 'ekstrabladet', { key1: 'val1', key2: 'val2' });
</script>

<script>
  // track page view. Normally, you should supply values for le_type, le_name and le_label as parameters
  ebComscore.sendComscorePageview({ name: 'myname', category: 'mycat', key3: 'val3', key4: 'val4' });
</script>

<!-- track deferred event (inpage=false). Useful for events involving page navigation on mobile browsers. -->
<!-- Normally you should supply values for le_type, le_name and le_label. -->
<a onclick="comscoreEvent(event, this, { name: 'myname', category: 'mycat', key5: 'val5' }, false);">my trigger</a>

<!-- track event immidiately (inpage=true). Does usually not work on mobile browsers when navigating -->
<!-- Normally you should supply values for le_type, le_name and le_label. -->
<a onclick="comscoreEvent(event, this, { name: 'myname', category: 'mycat', key5: 'val5' }, true);">my trigger</a>
<form onsubmit="comscoreEvent(event, this, { name: 'myname', category: 'mycat', key6: 'val6' }, true);"></form>

<script>

  // track event immediately. Alternative to the above.
  // Normally you should supply values for le_type, le_name and le_label.
  ebComscore.sendComscoreNonPageview({ name: 'myname', category: 'mycat', key7: 'val7', key8: 'val8' });

  // Create the order object, and initialize it with the base url (created by initializeComscore), customer ID and unique order ID
  var eComOrder = new ns_order(ebComscore.comscoreBaseUrl() + ebComscore.comscoreString, userId, orderId);
  // Add a line to the order, with the required fields
  eComOrder.addLine(productId, brandName, productGroup, shopName, 1, 0.00);
  // Send the order info to comscore
  eComOrder.sendOrder();

</script>