Page Ping showing up as page view?

I’m just getting familiar with snowplow and have example in which the page ping records I expect to see are showing up as page view records. There are events every 5 seconds as expected with this configuration, but always with event type e=pv and never e=pp. Is there something obviously wrong with this? I’ve looked through the docs and this board and not found any similar issues. Thanks!

<!doctype html> 
<html lang="en">
<head> 
  <script type="text/javascript">
    ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
    p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
    };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
    n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script",
    "http://d1fc8wv8zag5ca.cloudfront.net/2.9.0/sp.js","snowplow"));

    window.snowplow('newTracker', 'cf', 'localhost:8000', {
      appId: 'app-id',
      contexts: {
        webPage: true
      }       
    });
    window.snowplow('enableActivityTracking', 5, 5);
    window.snowplow('trackPageView');       
    </script>

    <title>Test Snowplow Page</title> 
</head>
<body> 
    <a href="http://www.google.com" class="tracked"> A Link Example </a>
</body>
</html>

Are the events being successfully received by the collector? i.e., is it returning 200 responses? If not it may be trying to flush the queue every time it sends an event with the contents of previous requests.

Thanks for the quick reply. Yes, I’ve tried a few different collectors and I’m getting 200s.

Hi @dxb, welcome :slight_smile:

Your example seems fine to me, I’ve taken it with 0 modifications and the page pings are tracking as expected into my local Snowplow Mini.

I think @mike is likely on to something. If you can take a look at your browsers local storage key/values in the developer tools, you should see a key of snowplowOutQueue_snowplow_cf_get. If this isn’t empty then it suggests the queue isn’t clearing on send and the tracker isn’t getting the response it needs from the collector to clear the queue (and is resending the same page view).

As another step, it might be worth trying a different browser to elimate any odd caching or state that might be going on.

Thanks @mike and @PaulBoocock for the help. I was able to see that snowplowOutQueue_snowplow_cf_get was not clearing and fix my issue. Total rookie mistake - I had been trying different collector endpoints just to find a quick and easy way to view the events being logged. At several points I set the collector as just a http://webhook.site so I could view tracking events nicely formatted. Strangely, this does give 200s (still not sure why) but the problem was the lack of the pixel i.

If anybody is trying to do a quick test like I was, my html works fine as above, as long as you set the collector as anything serving the pixel i. Trivially:

$ wget https://github.com/snowplow/snowplow/raw/master/2-collectors/cloudfront-collector/static/i
$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)

Then, I just view the events with the Snowplow Inspector chrome extension. Thanks again for the help everyone!

2 Likes