{"_id":"56a2c4dd2029df19002b595c","user":"56839cf74aecbd0d00a4659e","__v":11,"category":{"_id":"56a2c48a831e2a0d0069b1ad","version":"5668fab608f90021008e8832","__v":5,"project":"5668fab608f90021008e882f","pages":["56a2c4990aefae0d00b7fee4","56a2c4a342dfda0d000463a3","56a2c4bf06150b0d002ad262","56a2c4dd2029df19002b595c","56ec9485406ab51700200633"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-23T00:08:42.770Z","from_sync":false,"order":9,"slug":"debugging","title":"Web Debugging"},"version":{"_id":"5668fab608f90021008e8832","__v":19,"project":"5668fab608f90021008e882f","createdAt":"2015-12-10T04:08:22.769Z","releaseDate":"2015-12-10T04:08:22.769Z","categories":["5668fab708f90021008e8833","569740f124490c3700170a64","569742b58560a60d00e2c25d","569742bd0b09a41900b2446c","569742cd69393517000c82b3","569742f459a6692d003fad8f","569743020b09a41900b2446d","5697430b69393517000c82b5","56a17776470ae00d00c30642","56a2c48a831e2a0d0069b1ad","56b535757bccae0d00e9a1cd","56e1ff6aa49fdc0e005746b5","57e1c88115bf6522002a5e4e","57fa65275ba65a17008b988f","57fbeea34002550e004c032e","58474584889b6c2d00fb86e9","58475dcc64157f0f002f1907","587e7b5158666c2700965d4e","58a349fc30852819007ba083"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.18.0","version":"1.18"},"parentDoc":null,"githubsync":"","project":"5668fab608f90021008e882f","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-23T00:10:05.125Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"By default, we send three events to query.petametrics.com/__activity.gif associated with every pageview.\n<ul>\n<li>`pageview`: This is sent immediately upon our Javascript being loaded.</li>\n<li>`stuck_10s`: This is sent after you have been on the page for 10 seconds.</li>\n<li>`stuck_3m`: This is sent after you have been on the page for 3 minutes.</li>\n</ul>\nWhen you start pulling and showing recommendations from us, there’ll be additional activity events recording when our recommendations get shown, seen, and clicked. We’ll talk about those activities in the next section.\nThe timers that we use for heartbeat events are configurable. The default timers (10 seconds and 3 minutes) are chosen to achieve a balance between controlling the amount of data sent and getting a sense of user time on site. Depending on your use case, we can add timers for other amounts of time spent.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Understand what's getting sent\"\n}\n[/block]\nYou can access all events sent to query.petametrics.com using the Network panel. if you click on any such event you can dig deeper into the request headers.\n\nHere are the headers for an actual sample pageview event.\n\nNote that we recently changed the events to send to query.petametrics.com instead of api.petametrics.com. Therefore the example below is a little outdated.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Remote Address:54.193.101.92:80\\nRequest URL:http://api.petametrics.com/__activity.gif?ts=1440011328177&jsk=vba4vdhq7eo382ub&jsv=0.4&cu=http%3A%2F%2Fwww.liftigniter.com%2F&uid=c25c93e4-6b80-4e82-af8b-d50a9007c8c5&sid=b4e42984-05fe-4fd6-e2d3-9fec22f8ce66&pvid=c81893cb-93ed-422e-b9a3-01166ac8fc14&tzo=420&ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_4)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F44.0.2403.155%20Safari%2F537.36&l=en-US&os=MacIntel&scd=24&scrh=1080&scrw=1920&ref=&rs=6skz5sswm2oz85mi&sref=-1&uref=-1&sppx=0&sppc=0&dh=3130&ct=Predictive%20Analytics%20%7C%20Improve%20CTR%20%7C%20Taboola%20%7C%20Outbrain%20%7C%20Build%20Web%20Traffic&plh=c64b9d15f3b6aab193d17b9f0c156b78&e=pageview\\nRequest Method:GET\\nStatus Code:200 OK\\nResponse Headers\\nview source\\nConnection:keep-alive\\nContent-Length:35\\nContent-Type:image/gif\\nDate:Wed, 19 Aug 2015 19:08:48 UTC\\nServer:mustang\\nRequest Headers\\nview source\\nAccept:image/webp,*/*;q=0.8\\nAccept-Encoding:gzip, deflate, sdch\\nAccept-Language:en-US,en;q=0.8\\nConnection:keep-alive\\nHost:api.petametrics.com\\nReferer:http://www.liftigniter.com/\\nUser-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36\\nQuery String Parameters\\nview source\\nview URL encoded\\nts:1440011328177\\njsk:vba4vdhq7eo382ub\\njsv:0.4\\ncu:http://www.liftigniter.com/\\nuid:c25c93e4-6b80-4e82-af8b-d50a9007c8c5\\nsid:b4e42984-05fe-4fd6-e2d3-9fec22f8ce66\\npvid:c81893cb-93ed-422e-b9a3-01166ac8fc14\\ntzo:420\\nua:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36\\nl:en-US\\nos:MacIntel\\nscd:24\\nscrh:1080\\nscrw:1920\\nref:\\nrs:6skz5sswm2oz85mi\\nsref:-1\\nuref:-1\\nsppx:0\\nsppc:0\\ndh:3130\\nct:Predictive Analytics | Personalization | Machine Learning\\nplh:c64b9d15f3b6aab193d17b9f0c156b78\\ne:pageview\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nThe \"Query String Parameters\" section includes the parameters in the query in a human-readable form. The parameters are described below.\n\nParameters that vary with each event:\n<ul>\n<li>`e` is the type of event. In the example above, it is \"pageview\". The other possibilities are `stuck_10s` and `stuck_3m` (for heartbeat events) and some types associated with widget tracking.</li>\n<li>`sppx` (not sent by default, but can be turned on) is the pixels scrolled by the user so far. It is 0 if the user has not scrolled at all. For the event of type pageview this is likely to be 0, since it is fired immediately upon the page loading.</li>\n<li>`sppc` (not sent by default, but can be turned on) is the percentage of the page the user has scrolled.</li>\n</ul>\nParameters that are the same for all events within the same pageview, but differ across pageviews:\n<ul>\n<li>`pvid` is a unique ID generated for each pageview. It is common between all events within a pageview, but different across pageviews.</li>\n<li>`cu` is the current URL of the page.</li>\n<li>`ct` is the current title of the page.</li>\n<li>`ref` is the referrer to the current pageview.</li>\n</ul>\nCookie-based parameters that are the same for all events within the same session (i.e., until the user closes the browser) (see our [Cookies and Local Storage](doc:cookies-and-local-storage) section for more):\n<ul>\n<li>`sid` is the session ID, and corresponds to the value `_igt` in the cookie.</li>\n<li>`sref` is the referrer to the first page in the user’s current session. It is \"-1\" if the first pageview had no referrer. It corresponds to the value `_igsr` in the cookie.</li>\n</ul>\nCookie-based user-level parameters (see our section on cookies for more):\n<ul>\n<li>`uid` is the user ID, and corresponds to the value `_ig` in the cookie.</li>\n<li>`uref` is the referrer to the user’s first entry to the site. It is \"-1\" if the user’s first visit to the site had no referrer. it corresponds to the value `_igur` in the cookie.</li>\n</ul>\nParameters that are based on browser, device, and system settings. These are generally constant for a given user.\n<ul>\n<li>`ua` is user agent.</li>\n<li>`l` is the language set by the user in his or her browser.</li>\n<li>`os` is the user’s operating system.</li>\n<li>`scd` (not sent by default, but can be turned on) is the user’s screen color depth.</li>\n<li>`scrh` (not sent by default, but can be turned on) is the user’s screen height.</li>\n<li>`scrw` (not sent by default, but can be turned on) is the user’s screen width.</li>\n</ul>\nAlthough the user’s IP address is not passed as a query string parameter, it is included with the request. We use the IP address to extract information about the user’s location (country, city, and postal code).\nAdditionally, the petametrics.com cookies are sent with the request.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Check that the fields being sent are correct\"\n}\n[/block]\nBased on the descriptions above, you have an idea of what should get sent with each request. You can verify that the right field values are getting sent. Here are a few tips for verification:\n<ul>\n<li>You might want to test with different device types using the Emulator. When you change the device type using the Emulator, and reload the page, you should see the user agent parameter change. The operating system parameter will not change, because the Emulator does not spoof this variable.</li>\n<li>For customers who have scroll pixel and scroll percentage turned on: To check that the scroll pixel and scroll percentage work correctly, look at the values sent with the heartbeat events (`stuck_10s` and `stuck_3m`) and make sure to actually scroll before these heartbeat events get sent.</li>\n<li>For the query string parameters that correspond to our cookies, check the values against the cookies, as discussed in our section on cookies.</li>\n<li>To keep the requests made across multiple pageviews in the Network panel, check the \"Preserve log\" option.</li>\n<li>Open a new incognito window to start a new session and a new user. Note that Google Chrome supports only one incognito state at a time, so you need to close existing incognito windows before opening a new incognito window in order to make sure that a new user and new session are created.</li>\n<li>To start a new session but keep the existing user, quit and restart your browser. Note that on Windows and Linux systems, closing all windows of Chrome or Firefox automatically closes the process. However, on Macs, closing all windows does not close the process, and you need to explicitly quit the process.</li>\n</ul>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Report response errors\"\n}\n[/block]\nIt is highly unlikely that your query will receive any response other than a 200 OK. if you receive a different response, contact [Support](doc:support). In your email, include as much detail as possible about the error.","excerpt":"","slug":"pageview-and-heartbeat-events","type":"basic","title":"Pageview and Heartbeat Events"}

Pageview and Heartbeat Events


By default, we send three events to query.petametrics.com/__activity.gif associated with every pageview. <ul> <li>`pageview`: This is sent immediately upon our Javascript being loaded.</li> <li>`stuck_10s`: This is sent after you have been on the page for 10 seconds.</li> <li>`stuck_3m`: This is sent after you have been on the page for 3 minutes.</li> </ul> When you start pulling and showing recommendations from us, there’ll be additional activity events recording when our recommendations get shown, seen, and clicked. We’ll talk about those activities in the next section. The timers that we use for heartbeat events are configurable. The default timers (10 seconds and 3 minutes) are chosen to achieve a balance between controlling the amount of data sent and getting a sense of user time on site. Depending on your use case, we can add timers for other amounts of time spent. [block:api-header] { "type": "basic", "title": "1. Understand what's getting sent" } [/block] You can access all events sent to query.petametrics.com using the Network panel. if you click on any such event you can dig deeper into the request headers. Here are the headers for an actual sample pageview event. Note that we recently changed the events to send to query.petametrics.com instead of api.petametrics.com. Therefore the example below is a little outdated. [block:code] { "codes": [ { "code": "Remote Address:54.193.101.92:80\nRequest URL:http://api.petametrics.com/__activity.gif?ts=1440011328177&jsk=vba4vdhq7eo382ub&jsv=0.4&cu=http%3A%2F%2Fwww.liftigniter.com%2F&uid=c25c93e4-6b80-4e82-af8b-d50a9007c8c5&sid=b4e42984-05fe-4fd6-e2d3-9fec22f8ce66&pvid=c81893cb-93ed-422e-b9a3-01166ac8fc14&tzo=420&ua=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_10_4)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F44.0.2403.155%20Safari%2F537.36&l=en-US&os=MacIntel&scd=24&scrh=1080&scrw=1920&ref=&rs=6skz5sswm2oz85mi&sref=-1&uref=-1&sppx=0&sppc=0&dh=3130&ct=Predictive%20Analytics%20%7C%20Improve%20CTR%20%7C%20Taboola%20%7C%20Outbrain%20%7C%20Build%20Web%20Traffic&plh=c64b9d15f3b6aab193d17b9f0c156b78&e=pageview\nRequest Method:GET\nStatus Code:200 OK\nResponse Headers\nview source\nConnection:keep-alive\nContent-Length:35\nContent-Type:image/gif\nDate:Wed, 19 Aug 2015 19:08:48 UTC\nServer:mustang\nRequest Headers\nview source\nAccept:image/webp,*/*;q=0.8\nAccept-Encoding:gzip, deflate, sdch\nAccept-Language:en-US,en;q=0.8\nConnection:keep-alive\nHost:api.petametrics.com\nReferer:http://www.liftigniter.com/\nUser-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36\nQuery String Parameters\nview source\nview URL encoded\nts:1440011328177\njsk:vba4vdhq7eo382ub\njsv:0.4\ncu:http://www.liftigniter.com/\nuid:c25c93e4-6b80-4e82-af8b-d50a9007c8c5\nsid:b4e42984-05fe-4fd6-e2d3-9fec22f8ce66\npvid:c81893cb-93ed-422e-b9a3-01166ac8fc14\ntzo:420\nua:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36\nl:en-US\nos:MacIntel\nscd:24\nscrh:1080\nscrw:1920\nref:\nrs:6skz5sswm2oz85mi\nsref:-1\nuref:-1\nsppx:0\nsppc:0\ndh:3130\nct:Predictive Analytics | Personalization | Machine Learning\nplh:c64b9d15f3b6aab193d17b9f0c156b78\ne:pageview", "language": "text" } ] } [/block] The "Query String Parameters" section includes the parameters in the query in a human-readable form. The parameters are described below. Parameters that vary with each event: <ul> <li>`e` is the type of event. In the example above, it is "pageview". The other possibilities are `stuck_10s` and `stuck_3m` (for heartbeat events) and some types associated with widget tracking.</li> <li>`sppx` (not sent by default, but can be turned on) is the pixels scrolled by the user so far. It is 0 if the user has not scrolled at all. For the event of type pageview this is likely to be 0, since it is fired immediately upon the page loading.</li> <li>`sppc` (not sent by default, but can be turned on) is the percentage of the page the user has scrolled.</li> </ul> Parameters that are the same for all events within the same pageview, but differ across pageviews: <ul> <li>`pvid` is a unique ID generated for each pageview. It is common between all events within a pageview, but different across pageviews.</li> <li>`cu` is the current URL of the page.</li> <li>`ct` is the current title of the page.</li> <li>`ref` is the referrer to the current pageview.</li> </ul> Cookie-based parameters that are the same for all events within the same session (i.e., until the user closes the browser) (see our [Cookies and Local Storage](doc:cookies-and-local-storage) section for more): <ul> <li>`sid` is the session ID, and corresponds to the value `_igt` in the cookie.</li> <li>`sref` is the referrer to the first page in the user’s current session. It is "-1" if the first pageview had no referrer. It corresponds to the value `_igsr` in the cookie.</li> </ul> Cookie-based user-level parameters (see our section on cookies for more): <ul> <li>`uid` is the user ID, and corresponds to the value `_ig` in the cookie.</li> <li>`uref` is the referrer to the user’s first entry to the site. It is "-1" if the user’s first visit to the site had no referrer. it corresponds to the value `_igur` in the cookie.</li> </ul> Parameters that are based on browser, device, and system settings. These are generally constant for a given user. <ul> <li>`ua` is user agent.</li> <li>`l` is the language set by the user in his or her browser.</li> <li>`os` is the user’s operating system.</li> <li>`scd` (not sent by default, but can be turned on) is the user’s screen color depth.</li> <li>`scrh` (not sent by default, but can be turned on) is the user’s screen height.</li> <li>`scrw` (not sent by default, but can be turned on) is the user’s screen width.</li> </ul> Although the user’s IP address is not passed as a query string parameter, it is included with the request. We use the IP address to extract information about the user’s location (country, city, and postal code). Additionally, the petametrics.com cookies are sent with the request. [block:api-header] { "type": "basic", "title": "2. Check that the fields being sent are correct" } [/block] Based on the descriptions above, you have an idea of what should get sent with each request. You can verify that the right field values are getting sent. Here are a few tips for verification: <ul> <li>You might want to test with different device types using the Emulator. When you change the device type using the Emulator, and reload the page, you should see the user agent parameter change. The operating system parameter will not change, because the Emulator does not spoof this variable.</li> <li>For customers who have scroll pixel and scroll percentage turned on: To check that the scroll pixel and scroll percentage work correctly, look at the values sent with the heartbeat events (`stuck_10s` and `stuck_3m`) and make sure to actually scroll before these heartbeat events get sent.</li> <li>For the query string parameters that correspond to our cookies, check the values against the cookies, as discussed in our section on cookies.</li> <li>To keep the requests made across multiple pageviews in the Network panel, check the "Preserve log" option.</li> <li>Open a new incognito window to start a new session and a new user. Note that Google Chrome supports only one incognito state at a time, so you need to close existing incognito windows before opening a new incognito window in order to make sure that a new user and new session are created.</li> <li>To start a new session but keep the existing user, quit and restart your browser. Note that on Windows and Linux systems, closing all windows of Chrome or Firefox automatically closes the process. However, on Macs, closing all windows does not close the process, and you need to explicitly quit the process.</li> </ul> [block:api-header] { "type": "basic", "title": "3. Report response errors" } [/block] It is highly unlikely that your query will receive any response other than a 200 OK. if you receive a different response, contact [Support](doc:support). In your email, include as much detail as possible about the error.