{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Pageview and Heartbeat Events","type":"basic","slug":"pageview-and-heartbeat-events","excerpt":"","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.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Request URL: https://query.petametrics.com/v3/999gba4qphtjrmpe/0EMKw_ItTo9Dt37kPEV0Yw/__activity.gif?e=pageview&sppx=0&sppc=0&dh=8783&iwid=1271&ihei=726&ct=Fair+Housing+Act&ccu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&tspl=24770&blst=20738&ist=24719&iet=24755&ts=1592168127236&jsk=999gba4qphtjrmpe&jsv=20200609&cu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&uid=0EMKw_ItTo9Dt37kPEV0Yw&sid=a13fa484-82d3-41c3-9e69-af30a67b635c&pvid=6af7e825-7bef-488f-c7ef-4a4103d193ca&ua=Mozilla%2F5.0+(Macintosh%3B+Intel+Mac+OS+X+10_15_2)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F83.0.4103.97+Safari%2F537.36&l=en-US&os=MacIntel&scd=30&scrh=900&scrw=1440&tzo=420&site_name=HISTORY&sdk=bc-pixel\\nRequest Method: GET\\nStatus Code: 200 \\nRemote Address: 35.190.14.224:443\\nReferrer Policy: unsafe-url\\nalt-svc: clear\\ncontent-length: 35\\ncontent-type: image/gif\\ndate: Sun, 14 Jun 2020 20:55:27 GMT\\nserver: openresty/1.13.6.2\\nstatus: 200\\nvia: 1.1 google\\n:authority: query.petametrics.com\\n:method: GET\\n:path: /v3/999gba4qphtjrmpe/0EMKw_ItTo9Dt37kPEV0Yw/__activity.gif?e=pageview&sppx=0&sppc=0&dh=8783&iwid=1271&ihei=726&ct=Fair+Housing+Act&ccu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&tspl=24770&blst=20738&ist=24719&iet=24755&ts=1592168127236&jsk=999gba4qphtjrmpe&jsv=20200609&cu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&uid=0EMKw_ItTo9Dt37kPEV0Yw&sid=a13fa484-82d3-41c3-9e69-af30a67b635c&pvid=6af7e825-7bef-488f-c7ef-4a4103d193ca&ua=Mozilla%2F5.0+(Macintosh%3B+Intel+Mac+OS+X+10_15_2)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F83.0.4103.97+Safari%2F537.36&l=en-US&os=MacIntel&scd=30&scrh=900&scrw=1440&tzo=420&sdk=bc-pixel\\n:scheme: https\\naccept: image/webp,image/apng,image/*,*/*;q=0.8\\naccept-encoding: gzip, deflate, br\\naccept-language: en-US,en;q=0.9\\nreferer: https://www.history.com/topics/black-history/fair-housing-act\\nsec-fetch-dest: image\\nsec-fetch-mode: no-cors\\nsec-fetch-site: cross-site\\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36\\ne: pageview\\nsppx: 0\\nsppc: 0\\ndh: 8783\\niwid: 1271\\nihei: 726\\nct: Fair Housing Act\\nccu: https://www.history.com/topics/black-history/fair-housing-act\\ntspl: 24770\\nblst: 20738\\nist: 24719\\niet: 24755\\nts: 1592168127236\\njsk: 999gba4qphtjrmpe\\njsv: 20200609\\ncu: https://www.history.com/topics/black-history/fair-housing-act\\nuid: 0EMKw_ItTo9Dt37kPEV0Yw\\nsid: a13fa484-82d3-41c3-9e69-af30a67b635c\\npvid: 6af7e825-7bef-488f-c7ef-4a4103d193ca\\nua: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36\\nl: en-US\\nos: MacIntel\\nscd: 30\\nscrh: 900\\nscrw: 1440\\ntzo: 420\\nsdk: bc-pixel\",\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>`ccu` is the current canonical 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</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</ul>\nWe may additionally tracking other IDs in collaboration with the customer for syncing with othre services, only in collaboration with the customer.\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<li>`iwid` (not sent by default, but can be turned on) is the window's inner width.</li>\n<li>`ihei` (not sent by default, but can be turned on) is the window's inner height.</li>\n<li>`dh` (not sent by default, but can be turned on) is the document height.</li>\n</ul>\nParameters that are based on the loading and timing details:\n<ul>\n<li>`ts` is the timestamp from the client's side, as an epoch timestamp.</li>\n<li>`tspl` is the time since page load, in milliseconds.</li>\n<li>`blst` is the start time of the loading of the LiftIgniter JS file.</li>\n<li>`ist` is the start time of the execution of the initialization of the LiftIgniter JS file.</li>\n<li>`iet` is the end time of the execution of the initialization of the LiftIgniter JS file.</li>\n<li>`tzo` is the timezone offset of the user from UTC.</li>\n</ul>\nThe parameter `jsv` is the version of LiftIgniter JS file in the form of the date that the JS file was released.\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). We do not store the IP address in logs after extracting the user's location.\nAdditionally, any petametrics.com cookies are sent with the request, but no petametrics.com cookies should be getting set for users who do not directly visit subdomains under petametrics.com.\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.","updates":[],"order":3,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56a2c4dd2029df19002b595c","user":"56839cf74aecbd0d00a4659e","__v":11,"category":{"sync":{"isSync":false,"url":""},"pages":["56a2c4990aefae0d00b7fee4","56a2c4a342dfda0d000463a3","56a2c4bf06150b0d002ad262","56a2c4dd2029df19002b595c","56ec9485406ab51700200633"],"title":"Web Debugging","slug":"debugging","order":9,"from_sync":false,"reference":false,"_id":"56a2c48a831e2a0d0069b1ad","version":"5668fab608f90021008e8832","__v":5,"createdAt":"2016-01-23T00:08:42.770Z","project":"5668fab608f90021008e882f"},"version":{"version":"1.18","version_clean":"1.18.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5668fab708f90021008e8833","569740f124490c3700170a64","569742b58560a60d00e2c25d","569742bd0b09a41900b2446c","569742cd69393517000c82b3","569742f459a6692d003fad8f","569743020b09a41900b2446d","5697430b69393517000c82b5","56a17776470ae00d00c30642","56a2c48a831e2a0d0069b1ad","56b535757bccae0d00e9a1cd","56e1ff6aa49fdc0e005746b5","57e1c88115bf6522002a5e4e","57fa65275ba65a17008b988f","57fbeea34002550e004c032e","58474584889b6c2d00fb86e9","58475dcc64157f0f002f1907","587e7b5158666c2700965d4e","58a349fc30852819007ba083"],"_id":"5668fab608f90021008e8832","__v":19,"releaseDate":"2015-12-10T04:08:22.769Z","createdAt":"2015-12-10T04:08:22.769Z","project":"5668fab608f90021008e882f"},"createdAt":"2016-01-23T00:10:05.125Z","parentDoc":null,"githubsync":"","project":"5668fab608f90021008e882f"}

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. [block:code] { "codes": [ { "code": "Request URL: https://query.petametrics.com/v3/999gba4qphtjrmpe/0EMKw_ItTo9Dt37kPEV0Yw/__activity.gif?e=pageview&sppx=0&sppc=0&dh=8783&iwid=1271&ihei=726&ct=Fair+Housing+Act&ccu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&tspl=24770&blst=20738&ist=24719&iet=24755&ts=1592168127236&jsk=999gba4qphtjrmpe&jsv=20200609&cu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&uid=0EMKw_ItTo9Dt37kPEV0Yw&sid=a13fa484-82d3-41c3-9e69-af30a67b635c&pvid=6af7e825-7bef-488f-c7ef-4a4103d193ca&ua=Mozilla%2F5.0+(Macintosh%3B+Intel+Mac+OS+X+10_15_2)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F83.0.4103.97+Safari%2F537.36&l=en-US&os=MacIntel&scd=30&scrh=900&scrw=1440&tzo=420&site_name=HISTORY&sdk=bc-pixel\nRequest Method: GET\nStatus Code: 200 \nRemote Address: 35.190.14.224:443\nReferrer Policy: unsafe-url\nalt-svc: clear\ncontent-length: 35\ncontent-type: image/gif\ndate: Sun, 14 Jun 2020 20:55:27 GMT\nserver: openresty/1.13.6.2\nstatus: 200\nvia: 1.1 google\n:authority: query.petametrics.com\n:method: GET\n:path: /v3/999gba4qphtjrmpe/0EMKw_ItTo9Dt37kPEV0Yw/__activity.gif?e=pageview&sppx=0&sppc=0&dh=8783&iwid=1271&ihei=726&ct=Fair+Housing+Act&ccu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&tspl=24770&blst=20738&ist=24719&iet=24755&ts=1592168127236&jsk=999gba4qphtjrmpe&jsv=20200609&cu=https%3A%2F%2Fwww.history.com%2Ftopics%2Fblack-history%2Ffair-housing-act&uid=0EMKw_ItTo9Dt37kPEV0Yw&sid=a13fa484-82d3-41c3-9e69-af30a67b635c&pvid=6af7e825-7bef-488f-c7ef-4a4103d193ca&ua=Mozilla%2F5.0+(Macintosh%3B+Intel+Mac+OS+X+10_15_2)+AppleWebKit%2F537.36+(KHTML%2C+like+Gecko)+Chrome%2F83.0.4103.97+Safari%2F537.36&l=en-US&os=MacIntel&scd=30&scrh=900&scrw=1440&tzo=420&sdk=bc-pixel\n:scheme: https\naccept: image/webp,image/apng,image/*,*/*;q=0.8\naccept-encoding: gzip, deflate, br\naccept-language: en-US,en;q=0.9\nreferer: https://www.history.com/topics/black-history/fair-housing-act\nsec-fetch-dest: image\nsec-fetch-mode: no-cors\nsec-fetch-site: cross-site\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36\ne: pageview\nsppx: 0\nsppc: 0\ndh: 8783\niwid: 1271\nihei: 726\nct: Fair Housing Act\nccu: https://www.history.com/topics/black-history/fair-housing-act\ntspl: 24770\nblst: 20738\nist: 24719\niet: 24755\nts: 1592168127236\njsk: 999gba4qphtjrmpe\njsv: 20200609\ncu: https://www.history.com/topics/black-history/fair-housing-act\nuid: 0EMKw_ItTo9Dt37kPEV0Yw\nsid: a13fa484-82d3-41c3-9e69-af30a67b635c\npvid: 6af7e825-7bef-488f-c7ef-4a4103d193ca\nua: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36\nl: en-US\nos: MacIntel\nscd: 30\nscrh: 900\nscrw: 1440\ntzo: 420\nsdk: bc-pixel", "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>`ccu` is the current canonical 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> </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> </ul> We may additionally tracking other IDs in collaboration with the customer for syncing with othre services, only in collaboration with the customer. 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> <li>`iwid` (not sent by default, but can be turned on) is the window's inner width.</li> <li>`ihei` (not sent by default, but can be turned on) is the window's inner height.</li> <li>`dh` (not sent by default, but can be turned on) is the document height.</li> </ul> Parameters that are based on the loading and timing details: <ul> <li>`ts` is the timestamp from the client's side, as an epoch timestamp.</li> <li>`tspl` is the time since page load, in milliseconds.</li> <li>`blst` is the start time of the loading of the LiftIgniter JS file.</li> <li>`ist` is the start time of the execution of the initialization of the LiftIgniter JS file.</li> <li>`iet` is the end time of the execution of the initialization of the LiftIgniter JS file.</li> <li>`tzo` is the timezone offset of the user from UTC.</li> </ul> The parameter `jsv` is the version of LiftIgniter JS file in the form of the date that the JS file was released. 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). We do not store the IP address in logs after extracting the user's location. Additionally, any petametrics.com cookies are sent with the request, but no petametrics.com cookies should be getting set for users who do not directly visit subdomains under petametrics.com. [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.