Forum in maintenance, we will back soon 🙂
@asifa-b Do you mean how to distinguish between them on our website? Or which one is better to do in your case?
Regarding SAAS development, in my opinion the SAAS on WordPress is easier and more straightforward to build without coding at all.
@asifa-b Usually, free tools are used to increase traffic to your website because they are a "free" resource that captures people's attention. Try monetizing the tool pages according to SEO guidelines, which would help increase organic traffic to your website. Plus, you can build tools that have a high search volume and monetize them, too.
What type of tools do you have maybe I can give you some ideas.
Thanks a ton for your help. This is my tools page. https://marketertechie.com/ai-tools/
Would love to know your feedback on it and how I can improve it. I don't have much traffic on my website.
I would also like to know how to collect visitors email in exchange of free tool usage. Do you make a pop up form as soon as the user lands on the page or some other idea.
Thanks once again.
@asifa-b I just checked the tools, and they look good.
To get more traffic, you can create MVC blog posts on how to create AI tools. In each blog post, you show the readers how to create the tool and then add a link at the end that takes them to the tools page, where they can use it directly.
Another tip is that you can add a description on all the tool pages, where you highlight the keyword you're targeting, which will help improve the page's SEO, helping you get more traffic.
This two ideas were just at the top of my mind, do some research regarding how you can improve your website pages' SEO and you should start getting more traffic.
@asifa-b Hi.
If you are building straightforward and simple online tools, WordPress is way easier to get started, especially if you don't know NextJS.
It depends on the project and your skills.
If you are familiar with NextJS, and you want to to build a dedicated website for your tools or SaaS, then go with NextJS.
@husein Thank you for your suggestion.
I am already doing the second part. Can you please explain the first one ?
< To get more traffic, you can create MVC blog posts on how to create AI tools. In each blog post, you show the readers how to create the tool and then add a link at the end that takes them to the tools page, where they can use it directly. >
@asifa-b This is a type of blog post that helps you create simple yet effective posts in mass.
As the example I stated, you create blog posts that start with "how to build a free" and then the name of the tool you're teaching them how to build. Let's take an example from your tools page; you can create blog posts like:
how to build a free Revenue Calculator
how to build a free Welcome Message Generator
how to build a free FAQ Generator
etc....
However, before you write these posts, check if there's a search volume on these keywords, and if there's not, then no people are searching for the tools you're building. Therefore, you'll have to find keywords that people are searching for and build tools around them. Here are some tools with good search volume:
- AI Sentence Rewriter
- AI Text Summarizer
- AI Email Writer
- AI Paragraph Generator
@asifa-b it depends, sometimes you will be providing the tools as a lead magnet or to get more traffic, then you will be providing for free.
if you want to sell access to tools, you can provide limited points so users can test with, and if they want more, they buy
Hi Hason and team members.
I'm struggling with all of the applications, I tried 3-4 software and all are failing.
Not sure why, I'm thinking something simple, even on the automation workflow, when I download the file and upload it, I get an error.
And I didn't do anything 🤣
Something is going on and I or Chat can figure it out.
Here's the code for the headline generator, the UI is visible but no responses.
// Your Inputs
function setApiKey() {
return "AIzaSyDnFSzwdOjSHGNaL5RVyUkdCY8rzdPBrDE";
}
function setPrompt($input) {
return "Generate 5 catchy blog titles for a blog post about " . $input;
}
// Define your "model" as an associative array
function createTitlesModel($titles) {
return ["titles" => $titles];
}
// Helper JSON Functions
function modelToJson($modelInstance) {
return json_encode($modelInstance);
}
function extractJson($textResponse) {
$pattern = '/\{[^{}]*\}/';
preg_match_all($pattern, $textResponse, $matches);
$jsonObjects = [];
foreach ($matches[0] as $jsonStr) {
try {
$jsonObj = json_decode($jsonStr, true, 512, JSON_THROW_ON_ERROR);
array_push($jsonObjects, $jsonObj);
} catch (JsonException $e) {
// Extend the search for nested structures
$extendedJsonStr = extendSearch($textResponse, $jsonStr);
try {
$jsonObj = json_decode($extendedJsonStr, true, 512, JSON_THROW_ON_ERROR);
array_push($jsonObjects, $jsonObj);
} catch (JsonException $e) {
// Handle cases where the extraction is not valid JSON
continue;
}
}
}
return !empty($jsonObjects) ? $jsonObjects : null;
}
function extendSearch($text, $jsonStr) {
// Extend the search to try to capture nested structures
$start = strpos($text, $jsonStr);
$end = $start + strlen($jsonStr);
$nestCount = 0;
for ($i = $start; $i < strlen($text); $i++) {
if ($text[$i] === '{') {
$nestCount++;
} elseif ($text[$i] === '}') {
$nestCount--;
if ($nestCount === 0) {
return substr($text, $start, $i - $start + 1);
}
}
}
return substr($text, $start, $end - $start);
}
function jsonToModel($modelClass, $jsonData) {
try {
return $modelClass($jsonData);
} catch (Exception $e) {
echo "Validation error: " . $e->getMessage();
return null;
}
}
function validateJsonWithModel($modelClass, $jsonData) {
$validatedData = [];
$validationErrors = [];
if (is_array($jsonData)) {
foreach ($jsonData as $item) {
try {
$modelInstance = $modelClass($item);
array_push($validatedData, $modelInstance);
} catch (Exception $e) {
array_push($validationErrors, ["error" => $e->getMessage(), "data" => $item]);
}
}
} elseif (is_assoc($jsonData)) {
try {
$modelInstance = $modelClass($jsonData);
array_push($validatedData, $modelInstance);
} catch (Exception $e) {
array_push($validationErrors, ["error" => $e->getMessage(), "data" => $jsonData]);
}
} else {
throw new ValueError("Invalid JSON data type. Expected associative array or array.");
}
return [$validatedData, $validationErrors];
}
function is_assoc(array $arr) {
if (array() === $arr) return false;
return array_keys($arr) !== range(0, count($arr) - 1);
}
function generate_response_with_gemini($prompt) {
$api_key = setApiKey();
$api_url = 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=' . $api_key ;
// Headers for the Gemini API
$headers = [
'Content-Type' => 'application/json'
];
// Body for the Gemini API
$body = [
'contents' => [
[
'parts' => [
['text' => $prompt]
]
]
]
];
// Args for the WordPress HTTP API
$args = [
'method' => 'POST',
'headers' => $headers,
'body' => json_encode($body),
'timeout' => 120
];
// Send the request
$response = wp_remote_request($api_url, $args);
// Extract the body from the response
$responseBody = wp_remote_retrieve_body($response);
// Decode the JSON response body
$decoded = json_decode($responseBody, true);
// Extract the text
if (isset($decoded['candidates'][0]['content']['parts'][0]['text'])) {
$extractedText = $decoded['candidates'][0]['content']['parts'][0]['text'];
return $extractedText;
} else {
return 'Text not found in response';
}
}
function custom_tool_run() {
// Add CORS headers
header('Access-Control-Allow-Origin: *'); // Allows all origins
header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); // Specifies the allowed methods
header('Access-Control-Allow-Headers: Content-Type, Authorization'); // Specifies the allowed headers
// Variables
$input = $_POST['input'];
$basePrompt = setPrompt($input);
// Creating an instance of your model
$titlesModel = createTitlesModel(['title1', 'title2']);
// Convert model instance to JSON
$jsonModel = modelToJson($titlesModel);
// Create optimized prompt
$optimizedPrompt = $basePrompt . ". Please provide a response in a structured JSON format that matches the following model: " . $jsonModel;
// Generate content using the modified prompt
$gemeniResponse = generate_response_with_gemini($optimizedPrompt);
// Extract and validate the JSON from the response
$jsonObjects = extractJson($gemeniResponse);
wp_send_json_success($jsonObjects);
// Always die in functions echoing AJAX content
wp_die();
}
add_action('wp_ajax_custom_tool_run', 'custom_tool_run');
add_action('wp_ajax_nopriv_custom_tool_run', 'custom_tool_run');
Thanks for your help!
Deborah
Hi, Asifa B., this is Deborah, I viewed your site, Great job. I building the same type of website, but we're serving different customers. I would like to know if you could help me with my generators.
As I stated above, I think it's something simple. I'm a quick learner and follow instructions well.
I am looking forward to your response.
Deborah
@google-deborahpretty Please, when you want to attach codes to your message, use the "Attach Files" button in the text editor below because, like this, it's harder to read the code, and it takes up a lot of unnecessary space.
In addition, when you share codes publicly, don't provide your API key.
@google-deborahpretty Before we get into editing your code, try to preview your page, which contains the tool, and try the tool. If it still doesn't work, then the problem is with the UI because I just tested your PHP code on Thunderclient, and it worked perfectly. So, if it didn't work attach the UI code here so that I can revise it.
@google-deborahpretty it looks like your javascript is not executing with the php code. You will need to fix your JS codebase. And I second Husein here pls don't be sharing your api keys openly its not a safe practice. Also try not to hardcode it into your php scripts either. Use the define function in another site page and call it separately with "API_KEY" function or whatever call function name you may want to use.
@husein Ok, thanks; Husein, and thanks for the key tip. Do I need to resend the code? And were you able to figure out the problem? I'm still at square two.
@google-deborahpretty If you still haven't solved the problem, please attach both the frontend code and the backend code so that I can check it from my side.
Hi, thanks, who is this? I just wanted to give you a HUGE Thank YOU!
No, it's not figured out. I removed my API key.
@admin Hi Hassan!
Please can you check my websites mymochamoney.com and returndays.com to see how you can help me develop the AI tools you mentionned to bring more traffic?
I tried your script for "AI Tool on WordPress With Gemini". the scripts don't work.
Best,
Daniel