{"_id":"56a2c4a342dfda0d000463a3","parentDoc":null,"user":"56839cf74aecbd0d00a4659e","__v":7,"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"},"project":"5668fab608f90021008e882f","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"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-23T00:09:07.623Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"When a user loads a page on your website that has our Javascript snippet, here’s the order in which things happen. Keep the Network panel open, with the \"petametrics\" search filter. If things don’t work correctly, go to the Sources tab and check the box marking Call Stack as Async.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Sequence of events\"\n}\n[/block]\n<ol>\n<li>The user’s browser sees the instruction to load our Javascript file at cdn.petametrics.com. We respect the protocol the user is using to access the site: if the user is using HTTPS to access the site then they’ll access our Javascript via HTTPS as well.</li>\n<li>The user’s computer fetches the Javascript file from our CDN. When this happens, you’ll see a call to cdn.petametrics.com for the Javascript SDK file in the Network panel.</li>\n<li>The call succeeds, and you see a 200 OK response in the Network panel. If you click on it, you can then see the response, which is the full Javascript SDK file.</li>\n<li>The Javascript SDK file executes, and events are sent to query.petametrics.com. Almost immediately after Javascript SDK finishes loading, you’ll see a request to api.petametrics.com/__activity.gif. This is a pageview event being sent for us to record, and is triggered by the $p(\"send\", \"pageview\") line in your Javascript snippet. You can click on it and see the headers to know what information was sent. If the information is sent successfully, you’ll see a 200 OK.</li>\n</ol>\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/3f1f4dc-li-events.gif\",\n        \"li-events.gif\",\n        1427,\n        734,\n        \"#363636\"\n      ],\n      \"caption\": \"Sequence of petametrics.com events captured in the Chrome Network panel when visiting www.liftigniter.com\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Check that our Javascript loaded using console\"\n}\n[/block]\nIf you enter into the console:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$p\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nyou should see this output:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"function n.start.e.(anonymous function)()\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/0da27c8-li-console.gif\",\n        \"li-console.gif\",\n        1427,\n        734,\n        \"#2d6dc0\"\n      ],\n      \"caption\": \"Checking that the Javascript loaded successfully in the console on www.liftigniter.com.\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Debug beacon loading issue\"\n}\n[/block]\nWe process tens of millions of pageviews with our beacon every day, so it is quite unlikely that things will be broken. That said, here’s what you can do if our beacon is not working.\n\nIf no call was made to cdn.petametrics.com, this probably means that something went wrong with the Javascript snippet that you installed.\n\n* Go to the Elements panel and see if the Javascript snippet is present in the head section. Verify that you copied it correctly from the dashboard.\n* If you are using any ad-blocking or third-party blocking tools, make sure they are not blocking petametrics.com. For more information, see [Ad blockers](doc:ad-blockers).\n* Check your Console panel for any errors logged.\n\n\nIf a call was made, but gave an error (i.e., any code other than 200 OK):\n\n* Note the error code so you can get in touch with us about it.\n* Refresh the page to see if the error disappears.\n* Check your network connectivity and check if you can directly load our Javascript in your browser.\n* Check your Console panel for any errors logged.\n\nIf the call gave a 200 OK but \"$p\" in the Console panel gives an error, make a note of the error as well as the page on which you found it, and get in touch with [Support](doc:support). We’ll aim to fix it as soon as possible.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. Caching and refreshing of our Javascript\"\n}\n[/block]\nIf a user views multiple pages on your website, each of which has our Javascript snippet, the user’s browser will not fetch the Javascript from our server repeatedly. Rather, the browser will recognize that the resource was recently retrieved and will use that.\n\nIn order to make sure that the user’s browser periodically refreshes the Javascript file from our CDN, the Javascript snippet we ask you to install adds a timestamp parameter (that changes every hour) to the URL being fetched.\n\nThe parameter is ignored by our CDN, and is included solely so that your browser forces a reload of the file.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The Javascript that legacy customers had been asked to install did not include a timestamp parameter, and therefore was not guaranteed to refresh on the user’s side. We recommend you upgrade to the new Javascript snippet as soon as possible.\",\n  \"title\": \"Legacy implementation\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"If you have Google Chrome Developer Tools, you can choose to enable or disable cache. The Disable cache checkbox is at the top of your Network panel. If you deselect the Disable cache checkbox, then usually, when you load the second page from a website, the request to cdn.petametrics.com will say \\\"(from cache)\\\" in the Size/Content column and \\\"0 ms\\\" in the Time/Latency column. The exception occurs when your page requests straddle the hour.\",\n  \"title\": \"Disable cache during debugging\"\n}\n[/block]","excerpt":"","slug":"beacon-check","type":"basic","title":"Beacon check"}
When a user loads a page on your website that has our Javascript snippet, here’s the order in which things happen. Keep the Network panel open, with the "petametrics" search filter. If things don’t work correctly, go to the Sources tab and check the box marking Call Stack as Async. [block:api-header] { "type": "basic", "title": "1. Sequence of events" } [/block] <ol> <li>The user’s browser sees the instruction to load our Javascript file at cdn.petametrics.com. We respect the protocol the user is using to access the site: if the user is using HTTPS to access the site then they’ll access our Javascript via HTTPS as well.</li> <li>The user’s computer fetches the Javascript file from our CDN. When this happens, you’ll see a call to cdn.petametrics.com for the Javascript SDK file in the Network panel.</li> <li>The call succeeds, and you see a 200 OK response in the Network panel. If you click on it, you can then see the response, which is the full Javascript SDK file.</li> <li>The Javascript SDK file executes, and events are sent to query.petametrics.com. Almost immediately after Javascript SDK finishes loading, you’ll see a request to api.petametrics.com/__activity.gif. This is a pageview event being sent for us to record, and is triggered by the $p("send", "pageview") line in your Javascript snippet. You can click on it and see the headers to know what information was sent. If the information is sent successfully, you’ll see a 200 OK.</li> </ol> [block:image] { "images": [ { "image": [ "https://files.readme.io/3f1f4dc-li-events.gif", "li-events.gif", 1427, 734, "#363636" ], "caption": "Sequence of petametrics.com events captured in the Chrome Network panel when visiting www.liftigniter.com" } ] } [/block] [block:api-header] { "type": "basic", "title": "2. Check that our Javascript loaded using console" } [/block] If you enter into the console: [block:code] { "codes": [ { "code": "$p", "language": "javascript" } ] } [/block] you should see this output: [block:code] { "codes": [ { "code": "function n.start.e.(anonymous function)()", "language": "javascript" } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/0da27c8-li-console.gif", "li-console.gif", 1427, 734, "#2d6dc0" ], "caption": "Checking that the Javascript loaded successfully in the console on www.liftigniter.com." } ] } [/block] [block:api-header] { "type": "basic", "title": "3. Debug beacon loading issue" } [/block] We process tens of millions of pageviews with our beacon every day, so it is quite unlikely that things will be broken. That said, here’s what you can do if our beacon is not working. If no call was made to cdn.petametrics.com, this probably means that something went wrong with the Javascript snippet that you installed. * Go to the Elements panel and see if the Javascript snippet is present in the head section. Verify that you copied it correctly from the dashboard. * If you are using any ad-blocking or third-party blocking tools, make sure they are not blocking petametrics.com. For more information, see [Ad blockers](doc:ad-blockers). * Check your Console panel for any errors logged. If a call was made, but gave an error (i.e., any code other than 200 OK): * Note the error code so you can get in touch with us about it. * Refresh the page to see if the error disappears. * Check your network connectivity and check if you can directly load our Javascript in your browser. * Check your Console panel for any errors logged. If the call gave a 200 OK but "$p" in the Console panel gives an error, make a note of the error as well as the page on which you found it, and get in touch with [Support](doc:support). We’ll aim to fix it as soon as possible. [block:api-header] { "type": "basic", "title": "4. Caching and refreshing of our Javascript" } [/block] If a user views multiple pages on your website, each of which has our Javascript snippet, the user’s browser will not fetch the Javascript from our server repeatedly. Rather, the browser will recognize that the resource was recently retrieved and will use that. In order to make sure that the user’s browser periodically refreshes the Javascript file from our CDN, the Javascript snippet we ask you to install adds a timestamp parameter (that changes every hour) to the URL being fetched. The parameter is ignored by our CDN, and is included solely so that your browser forces a reload of the file. [block:callout] { "type": "info", "body": "The Javascript that legacy customers had been asked to install did not include a timestamp parameter, and therefore was not guaranteed to refresh on the user’s side. We recommend you upgrade to the new Javascript snippet as soon as possible.", "title": "Legacy implementation" } [/block] [block:callout] { "type": "info", "body": "If you have Google Chrome Developer Tools, you can choose to enable or disable cache. The Disable cache checkbox is at the top of your Network panel. If you deselect the Disable cache checkbox, then usually, when you load the second page from a website, the request to cdn.petametrics.com will say \"(from cache)\" in the Size/Content column and \"0 ms\" in the Time/Latency column. The exception occurs when your page requests straddle the hour.", "title": "Disable cache during debugging" } [/block]