AMI | Global Math

3.2 Ads, WhatsApp, Protection, SEO, and Fixing Code That Doesn't Appear

The final lesson brings together the advanced features: ads, WhatsApp buttons, copy protection, Next Post, SEO tidying, and how to fix code that doesn't appear. You already installed the license code in Lesson 1.1.

In This Lesson

  1. 1Ads and AdSense Configuration
  2. 2WhatsApp button
  3. 3Copy protection
  4. 4Next Post
  5. 5Page speed
  6. 6SEO tidying
  7. 7Realistic SEO
  8. 8If it doesn't appear
How module features work: page opens, license is checked, modules load, features appear.
Figure 1. How module features work: page opens, license is checked, modules load, features appear.
Key TakeawayHero, WhatsApp, protection, Speed, SEO, and Next Post ads are module features. All of them require an active license and appear 1 to 3 seconds after the page opens.

Ads and AdSense Configuration

Ads are the revenue source of a news site. There are two ways: install them manually in specific sections, or fill in the unit IDs once and let the template place them automatically.

Place it inLayout → Header ADS, Post ADS 1 (before content), Post ADS 2 (after content), Post ADS 3 (end of article), Footer ADS, and AdSense Configuration (Code)

Manual ad gadget: paste the ad code or banner image in the desired section. The title {ads} hides the gadget title. AdSense Configuration fills in the ad unit IDs once, then the template places ads automatically in the right positions.

Ready-to-paste code

Ad gadget title:  {ads}
<script>(function(c,u){for(var k in u)if(u[k]!=='')c[k]=u[k]})(window.AKSARA_ADS=window.AKSARA_ADS||{},{client:'ca-pub-1234567890123456',top:'',article:'1111111111',end:'2222222222',sidebar:'3333333333',sidebarEnd:'',feed:'4444444444',footer:'',maxArticle:2});</script>

Steps

  1. Manual: add an HTML/JavaScript gadget in Post ADS 1, 2, or 3 (or Header/Footer ADS), fill in the Title {ads}, paste the ad code, Save.
  2. Automatic: open AdSense Configuration (Code) → Edit, change the text between the quotes: fill client with the publisher ID (ca-pub-...), then the slot ID for each position. Don't remove the <script> tag.
  3. Positions left empty are not displayed.

What each part of the code means

PartMeaning
clientAdSense publisher ID.
top, article, endSlot at the top of the article, inside the article, and at the end of the article.
sidebar, sidebarEndAd slots in the sidebar.
feedSlot in the homepage article list (after the 3rd and 8th cards).
footerSlot in the footer.
maxArticleMaximum number of ads inside an article (default 2, limit 4).
NoteAutomatic ads only appear in articles that are long enough. Don't stack manual and automatic ads in the same position.

Floating WhatsApp Button

This button lets readers contact you directly.

Place it inLayout → Footer Left (or another footer section that appears on all pages) → HTML/JavaScript gadget

A round green button in the bottom-right corner that opens WhatsApp to your number with an initial message. When the cursor hovers, the button expands and shows a label. A greeting bubble appears once per session and can be closed. The light pulse runs only 3 times to stay light on older laptops.

Ready-to-paste code

<div hidden>{getWhatsApp} $number={081234567890} $text={Hello, I read [judul] [url]} $greeting={Hi! How can we help you?}</div>

Steps

  1. Add an HTML/JavaScript gadget in Footer Left, leave the Title empty.
  2. Change the number to your WhatsApp number, then paste the code in Content and Save.
  3. To turn it off without deleting, add $status={off} after {getWhatsApp}.

What each part of the code means

PartMeaning
$numberWhatsApp number (required). A leading 0 is automatically changed to 62.
$textInitial message. [judul] and [url] are replaced with the page title and address.
$greeting, $delayGreeting bubble text and its appearance delay in seconds. Without $greeting, the bubble doesn't show.
$label, $colorLabel text and button color (hex code).
$position, $bottomright or left, and the distance from the bottom in pixels (default 76).
$showall (all pages), home, or post.
$statuson or off.
Button with a greeting bubble
Figure 2. Button with a greeting bubble
When the cursor hovers
Figure 3. When the cursor hovers

Article Copy Protection

Protection blocks ordinary copying of article text and can be turned on or off at any time.

Place it inLayout → Footer Left (or another footer section that appears on all pages) → HTML/JavaScript gadget

Blocks copying article text: copy, cut, right-click, image dragging, and text selection in the article body (including Next Post articles). Visitors who try see a brief notification.

Ready-to-paste code

<div hidden>{getProtect} $status={on}</div>
<div hidden>{getProtect} $status={off}</div>

Steps

  1. Add an HTML/JavaScript gadget in Footer Left and paste the $status={on} code.
  2. To turn it off, change it to $status={off} or delete the gadget.
  3. Sections that may still be copied (for example codes or bank account numbers): add class="allow-copy" in HTML mode, e.g. <span class="allow-copy">ABC-123</span>.

What each part of the code means

PartMeaning
$statuson active, off disabled.
$scopearticle (default, article body only) or all (the entire page).
$noticeReplaces the notification text.
Notification when a visitor tries to copy
Figure 4. Notification when a visitor tries to copy
NoteThis protection only blocks ordinary copying. Screenshots, viewing the page source, browser reading mode, and disabling JavaScript can still capture the content. Ordinary visitors also can't copy anything in the article, so consider the impact.

Next Post: Automatic Next Article

Next Post loads the next article as the reader scrolls, so readers stay longer.

Place it inLayout → Settings: Sidebar and Next Post (1 gadget). Optional: Widget Antar Artikel (Next Post) (maximum 3 gadgets, appears below the divider line between articles)

When the reader scrolls down, the next article is loaded automatically below. This feature is off until the settings gadget contains the word on. Post ADS 1 and 2 also appear in each next article, and each article counts as one view after being in the middle of the screen for about 1.2 seconds.

Ready-to-paste code

on $max={5}
on $max={5} nextbanner=hide
on $max={5} nextga=on

Steps

  1. Open Settings: Sidebar and Next Post → Edit → write on $max={5} → Save.
  2. Additional options are written in the same gadget, separated by spaces (see the table).
  3. Avoid the words off, mati, nonaktif (turns off Next Post) and left, kiri, none, tanpa (changes the sidebar position), unless that is your intention.

What each part of the code means

PartMeaning
onTurns on Next Post. Remove this word or write off to turn it off.
$max={5}Number of next articles (1 to 10, default 10).
nextbanner=hideHides Post ADS 1 and 2 in the next articles. Without this option, ads appear.
nextadsense=hideHides only the AdSense units there; regular banners still appear.
nextview=noTurns off view counting for the next articles.
nextga=onSends a page_view event to Google Analytics 4 for each next article.

Page Speed

Two small settings to make page transitions feel faster.

Place it inLayout → Footer Left (or another footer section that appears on all pages) → HTML/JavaScript gadget

Two small settings to make page transitions feel faster. The template already has many built-in optimizations, so this module only adds two things that aren't there yet.

Ready-to-paste code

<div hidden>{getSpeed} $status={on}</div>
<div hidden>{getSpeed} $status={on} $prefetch={on} $preconnect={off}</div>

Steps

  1. Add an HTML/JavaScript gadget in Footer Left, leave the Title empty.
  2. Paste the code in Content, then Save.
  3. To turn everything off, write $status={off} or delete the gadget.

What each part of the code means

PartMeaning
$prefetchArticle pages that the cursor hovers over (or touches on a phone) are fetched in advance, so they open faster when clicked. Maximum 8 pages per visit. Automatically skipped in Save-Data mode or on 2G connections.
$preconnectSets up the connection to Google ad servers earlier. Only applies if AdSense Configuration is filled in.
$statuson or off.
NoteThis module cannot speed up the connection to the server. Messages like ERR_CONNECTION_TIMED_OUT come from the network or DNS, not from the page.

SEO Tidying

Tidying up technical SEO details that are often missed.

Place it inLayout → Footer Left (or another footer section that appears on all pages) → HTML/JavaScript gadget

Tidies up technical SEO details that are often missed: image alternative text, link attributes, and empty meta descriptions. This module does not create structured data because the template already has it.

Ready-to-paste code

<div hidden>{getSeo} $status={on} $desc={Write a short description of your blog here, 100 to 155 characters.}</div>

Steps

  1. Add an HTML/JavaScript gadget in Footer Left and paste the code. Replace the contents of $desc with your homepage description.
  2. Save. To turn off one part, write for example $alt={off}; to turn everything off, $status={off}.
  3. A stronger method for the homepage: also fill it in Blogger → Settings → Search preferences → Meta description.

What each part of the code means

PartMeaning
$altFills in the alt attribute on article images that don't have one, from the image caption or article title. Deliberately empty alt attributes are not changed.
$linksLinks that open in a new tab are given rel="noopener".
$metaIf the meta description is empty or less than 50 characters, it is filled from the beginning of the article (article pages) or from $desc (homepage). og:description and twitter:description are also filled if empty.
$descHomepage description. About 155 characters maximum are used.
NoteChanges made via JavaScript are only read by search engines that run JavaScript (Google does). Descriptions written directly in Blogger remain the most reliable.

SEO and Indexing: Realistic Steps

This section is honest about what can and cannot be done.

Place it inSeveral Blogger menus and Google Search Console (there is no code for this)

No script can guarantee that an article reaches page one of Google or produces high-paying ads. What can be done is to make sure Google can easily find, understand, and evaluate your blog.

Steps

  1. Meta description. Blogger → Settings → Search preferences → Meta description. Fill in 100 to 155 characters about your blog. An empty homepage is a common SEO gap.
  2. Description per article. In the post editor, open Post settings → Search description, then write a unique summary for each article.
  3. Search Console. Register the blog, open the Sitemap menu, submit sitemap.xml and sitemap-pages.xml. For new articles, use URL Inspection → Request indexing.
  4. Internal links. Install the Sitemap page, Related Posts, and a hero or Featured on the homepage so new articles are found quickly.
  5. Speed. Measure with PageSpeed Insights. Compress images before uploading and avoid too many blocks on the homepage.
  6. Ads. Revenue per click is determined by the Google auction and influenced by niche, language, reader country, and traffic quality. Make sure ads.txt is installed (Blogger → Settings → Monetization → Custom ads.txt). Don't ask visitors to click ads or modify ads, as that violates AdSense policy.
  7. Language. Mixing several languages in one blog makes it hard to recognize. Separate by label or by blog if possible.
NoteBlogger and Search Console menu names may differ slightly from the text above because their interfaces change frequently.

If It Doesn't Appear, Check This Order

Follow the diagram from left to right. Stop at the step where the answer is No, then fix it.

Check diagram: gadget type, section name, code writing, label, then module and license.
Figure 5. Check diagram: gadget type, section name, code writing, label, then module and license.
  1. Gadget type and section name. Must be HTML/JavaScript in the correct section. The default ticker is still Popular Posts, so delete it first then replace it.
  2. Code writing. Match the example, including {getPosts} with a capital P and the curly braces.
  3. Label name. Match it exactly as in Blogger. Specifically for {getHero}, a wrong label is replaced with the latest articles.
  4. Next Post doesn't appear. The Settings: Sidebar and Next Post gadget must contain the word on.
  5. Sidebar shifts for no reason. That settings gadget must not contain the words left, kiri, none, or tanpa.
  6. Module features require an active license and the latest module.
  7. After saving, press Ctrl+F5 or try in an incognito window.
  8. Featured Posts and Ticker News only accept one gadget. An empty Content Section is not displayed.
NoteThe message ERR_CONNECTION_TIMED_OUT or the site not opening comes from the network or DNS, not from the code in the Layout. Try another network or change DNS to 1.1.1.1 and 8.8.8.8.
ExerciseInstall the WhatsApp button with your number, then test it: click the button and make sure the initial message contains the page title. Then turn it off with $status={off} and make sure the button disappears.
Lebih baru Lebih lama

Contact Us