├── LICENSE ├── README.md ├── content.js ├── icon.png ├── manifest.json ├── popup.html └── popup.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 SerpApi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

SerpApi's ChatGPT Review Analyzer Chrome Extension

2 |

A Chrome Extension for extracting valuable insights from reviews, generating concise summaries, sentiment analysis, and keyword extraction

3 | 4 | 5 |
6 | 7 | [![Contributors][contributors-shield]][contributors-url] 8 | [![Forks][forks-shield]][forks-url] 9 | [![Stargazers][stars-shield]][stars-url] 10 | [![Issues][issues-shield]][issues-url] 11 | [![Issues][issuesclosed-shield]][issuesclosed-url] 12 | [![MIT License][license-shield]][license-url] 13 | 14 |
15 | 16 | 17 |

18 | review-analyzer 19 |

20 | 21 |

22 | A Blog Post with example usecases and deeper explanation: Open Source Review Analyzer Chrome Extension for ChatGPT 23 |

24 | 25 |
26 |

Installation

27 | 28 | The extension isn’t published under Chrome Web Store yet, so the only web page you can access is the GitHub Repository for the moment. It doesn’t have support for Firefox yet. You will need a Chrome or a Brave Browser to use it. 29 | 30 | 1. Download the repository as a ZIP file and extract it, or just clone it. 31 | 2. In your Chrome or Brave browser, open the Extensions page (`chrome://extensions` for Chrome Browser, `brave://extensions` for Brave Browser). 32 | 3. Enable "Developer mode" in the top right corner of the page. 33 | 4. Click "Load unpacked" and select the extracted folder from your computer. 34 | 35 | --- 36 | 37 |

Usage

38 | 39 | 1. Navigate to ChatGPT webpage. 40 | 2. Navigate to [SerpApi Playground](https://serpapi.com/playground?engine=google_maps_reviews&data_id=0x89c259af336b3341%3A0xa4969e07ce3108de&hl=en) to filter the review results you desire. 41 | 3. Click on the SerpApi's ChatGPT Review Analyzer icon in your browser. 42 | 4. A popup window will open. Copy the review results you gathered from SerpApi in JSON format. (Do not try to trim the unnecessary parts.) 43 | 5. Click on the Analyze Button. 44 | 6. The extension will automatically process and display insights from the reviews, providing you with the 10 most common labels and their percentages based on occurrence rate. It will also indicate whether a label is positive or negative. 45 | 46 | --- 47 | 48 |

Example with a Cafe in New York

49 | 50 |

51 | image 52 |

53 | 54 |

Output

55 | 56 | ```bash 57 | Quality of coffee (70% positive) 58 | Service (40% positive, 30% negative) 59 | Ambiance/decor (60% positive) 60 | Availability of snacks/food options (40% positive, 20% negative) 61 | Price (20% negative) 62 | Seating/WiFi (60% positive) 63 | Milk options (30% positive, 10% negative) 64 | Accessibility (10% positive) 65 | Cleanliness (20% positive) 66 | Location (10% positive) 67 | ``` 68 | 69 | --- 70 | 71 |

Example with a Custom Array containing reviews of SerpApi

72 | 73 |

74 | image 75 |

76 | 77 |

Output

78 | 79 | ```bash 80 | Ease of Use (Positive) - 23% 81 | Fast and Responsive API (Positive) - 20% 82 | Excellent Customer Support (Positive) - 18% 83 | Comprehensive and Versatile (Positive) - 15% 84 | Pricing Concerns (Negative) - 10% 85 | Documentation Quality (Mixed) - 7% (Positive: 5%, Negative: 2%) 86 | Integration Issues (Negative) - 3% 87 | Wide Range of Features (Positive) - 2% 88 | Real-time Results (Positive) - 1% 89 | Wish for More Free Credits (Negative) - 1% 90 | ``` 91 | 92 | --- 93 | 94 |

Example Prompt on ChatGPT

95 | 96 |

97 | image 98 |

99 | 100 | [contributors-shield]: https://img.shields.io/github/contributors/serpapi/review-analyzer.svg 101 | [contributors-url]: https://github.com/serpapi/review-analyzer/graphs/contributors 102 | [forks-shield]: https://img.shields.io/github/forks/serpapi/review-analyzer.svg 103 | [forks-url]: https://github.com/serpapi/review-analyzer/network/members 104 | [stars-shield]: https://img.shields.io/github/stars/serpapi/review-analyzer.svg 105 | [stars-url]: https://github.com/serpapi/review-analyzer/stargazers 106 | [issues-shield]: https://img.shields.io/github/issues/serpapi/review-analyzer.svg 107 | [issues-url]: https://github.com/serpapi/review-analyzer/issues 108 | [issuesclosed-shield]: https://img.shields.io/github/issues-closed/serpapi/review-analyzer.svg 109 | [issuesclosed-url]: https://github.com/serpapi/review-analyzer/issues?q=is%3Aissue+is%3Aclosed 110 | [license-shield]: https://img.shields.io/github/license/serpapi/uule_converter.svg 111 | [license-url]: https://github.com/serpapi/review-analyzer/blob/master/LICENSE 112 | 113 | -------------------------------------------------------------------------------- /content.js: -------------------------------------------------------------------------------- 1 | chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { 2 | if (request.action === 'setPrompt') { 3 | setPrompt(request.prompt); 4 | } 5 | }); 6 | 7 | function setPrompt(prompt) { 8 | const chatGPTPromptBar = document.querySelector('textarea'); 9 | 10 | if (chatGPTPromptBar) { 11 | chatGPTPromptBar.value = prompt; 12 | chatGPTPromptBar.dispatchEvent(new Event('input', { bubbles: true })); 13 | triggerSendButton(); 14 | } else { 15 | const observer = new MutationObserver((mutations) => { 16 | const chatGPTPromptBar = document.querySelector('textarea'); 17 | if (chatGPTPromptBar) { 18 | chatGPTPromptBar.value = prompt; 19 | chatGPTPromptBar.dispatchEvent(new Event('input', { bubbles: true })); 20 | triggerSendButton(); 21 | observer.disconnect(); 22 | } 23 | }); 24 | 25 | observer.observe(document.body, { childList: true, subtree: true }); 26 | } 27 | } 28 | 29 | function triggerSendButton() { 30 | const sendButton = document.querySelector('button.absolute'); 31 | if (sendButton) { 32 | sendButton.click(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/serpapi/review-analyzer/654c60ce6f70e50edcd5bf724771d21585540a65/icon.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 3, 3 | "name": "ChatGPT Review Analyzer", 4 | "version": "1.0", 5 | "description": "Unlock powerful customer sentiment insights with ChatGPT! Analyze SerpApi review results in JSON format or an array of reviews.", 6 | "host_permissions": ["https://*.openai.com/*"], 7 | "action": { 8 | "default_icon": "icon.png", 9 | "default_popup": "popup.html" 10 | }, 11 | "content_scripts": [ 12 | { 13 | "matches": [""], 14 | "js": ["content.js"], 15 | "all_frames": true 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 |

ChatGPT Review Analyzer

14 |

Enter either a JSON result from one of the SerpApi's Reviews Engines or enter a list of reviews in an array format:

15 | 16 |
17 | 18 |

19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /popup.js: -------------------------------------------------------------------------------- 1 | document.getElementById('analyze').addEventListener('click', () => { 2 | const inputReviews = document.getElementById('input-reviews').value; 3 | const parsedReviews = parseReviews(inputReviews); 4 | 5 | if (parsedReviews.error) { 6 | document.getElementById('error-message').innerText = parsedReviews.error; 7 | } else { 8 | const formattedPrompt = createPrompt(parsedReviews); 9 | 10 | chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { 11 | chrome.tabs.sendMessage(tabs[0].id, { 12 | action: 'setPrompt', 13 | prompt: formattedPrompt, 14 | }); 15 | }); 16 | } 17 | }); 18 | 19 | function parseReviews(input) { 20 | try { 21 | const jsonInput = JSON.parse(input); 22 | if (Array.isArray(jsonInput.reviews) && jsonInput.reviews.length > 0) { 23 | return jsonInput.reviews.map(review => review.snippet || review.text || (review.comment && review.comment.text)); 24 | } else if (jsonInput.reviews_results && Array.isArray(jsonInput.reviews_results.reviews) && jsonInput.reviews_results.reviews.length > 0) { 25 | return jsonInput.reviews_results.reviews.map(review => review.content); 26 | } else if (jsonInput.reviews_results && jsonInput.reviews_results.reviews && Array.isArray(jsonInput.reviews_results.reviews.customer_reviews) && jsonInput.reviews_results.reviews.customer_reviews.length > 0) { 27 | return jsonInput.reviews_results.reviews.customer_reviews.map(review => review.text); 28 | } else if (Array.isArray(jsonInput) && jsonInput.length > 0) { 29 | return jsonInput; 30 | } 31 | } catch (error) { 32 | return { error: 'Failed to parse input' }; 33 | } 34 | 35 | return { error: 'Failed to parse input' }; 36 | } 37 | 38 | function createPrompt(reviews) { 39 | let prompt = 'Reviews:\n'; 40 | for (const review of reviews) { 41 | prompt += `- ${review}\n`; 42 | } 43 | prompt += '\nCreate 10 most common labels for these reviews and give percentages based on their occurrence rate, and also if the label is negative or positive.'; 44 | return prompt; 45 | } 46 | --------------------------------------------------------------------------------