At RicheyWeb, we don’t skimp on the details. Our freshly launched System - X Autopost plugin for Joomla (version 1.0.0, just released!) makes sharing your content to X (formerly Twitter) a breeze. While setting up Twitter Cards to display rich previews of your Joomla posts is mostly plug-and-play, there’s one optional field that completes the package: your X user ID.
X marks the user ID as optional for Twitter Cards, but at RicheyWeb, we’re all about crossing every t and dotting every i. Including your user ID (e.g., 1481734492154912770 for @ComRicheyweb) ensures your Twitter Cards are perfectly tied to your profile, enhancing attribution and analytics. Digging it out manually? No thanks.
We’ve created a bookmarklet—a one-click JavaScript tool you can drag to your bookmarks toolbar—that grabs your user ID from any X profile page. No API keys, no fuss, and it works right in your browser. This guide shows you how to add it and use it with System - X Autopost for flawless Twitter Card setup.
Why Add Your X User ID to Twitter Cards?
Twitter Cards turn your Joomla posts into eye-catching previews on X, complete with images, titles, and descriptions. Adding your user ID to the twitter:creator:id meta tag:
- Links to You: Credits your @username in card interactions, boosting visibility.
- Sharpens Analytics: Ties engagement to your X account for better tracking.
- Satisfies Perfectionism: Completes your System - X Autopost setup, RicheyWeb style.
Without the ID, your cards still work, but why leave a blank unfilled? Our bookmarklet makes grabbing it effortless.
How the Bookmarklet Works
The bookmarklet is a compact JavaScript snippet that runs on an X profile page (e.g., https://x.com/YourUsername). It:
- Scans the page’s HTML for the <script type="application/ld+json"> tag, where X stores structured data.
- Pulls out the mainEntity.identifier field—your numeric user ID.
- Shows the ID in an alert or copies it to your clipboard (depending on the version).
Since it runs directly on X’s domain, it avoids CORS issues and needs no external servers or authentication. It’s built for Joomla users who demand precision without complexity.
Note:
- Only works on X profile pages (e.g., https://x.com/ComRicheyweb).
- Relies on X’s current page structure; changes are rare but possible.
- Use ethically, per X’s terms, on your own or public profiles.
Adding the Bookmarklet
We’ve made it dead simple: just drag a link to your bookmarks toolbar! Most modern browsers (Chrome, Firefox, Edge, Safari) support dragging bookmarklet links directly. Below are two versions of the bookmarklet—pick the one that suits you.
Step-by-Step
- Visit the Bookmarklet Download Page on RicheyWeb.
- Find the bookmarklet link (below).
- Drag the link to your browser’s Bookmarks toolbar or menu.
- Alternatively, right-click the link, select “Bookmark This Link” (or similar), and save it as “Get X User ID”.
The Bookmarklet
This copies the ID to your clipboard and confirms with an alert. (Note: Requires HTTPS or user permission in some browsers.)
Drag this link to your Bookmarks toolbar Code (for reference):
javascript:(function(){try{const ldScript=document.querySelector('script[type="application/ld+json"]');if(!ldScript){alert('Error: JSON-LD script not found');return;}const jsonObj=JSON.parse(ldScript.textContent);const userId=jsonObj?.mainEntity?.identifier;if(!userId){alert('Error: User ID not found');return;}navigator.clipboard.writeText(userId).then(() => alert('User ID copied to clipboard: '+userId)).catch(() => alert('Copy failed—User ID: '+userId));}catch(e){alert('Error: '+e.message);}})();
Test It: Go to your X profile (e.g., https://x.com/ComRicheyweb), click the bookmarklet in your toolbar, and see your ID (mine’s 1481734492154912770). Copy it or note it down.
Using the User ID in System - X Autopost
With your user ID in hand, here’s how to plug it into System - X Autopost for perfect Twitter Cards:
- Install the Plugin: Download System - X Autopost from RicheyWeb and install via Joomla’s Extension Manager.
- Get Your ID: Visit your X profile, click the bookmarklet, and copy the ID (or write it down from the alert).
- Configure Twitter Cards:
- In Joomla Admin, go to System > Plugins > System - X Autopost.
- Navigate to the Twitter Card settings tab.
- Paste your user ID into the “Twitter Creator ID” field (for twitter:creator:id).
- Adjust other card settings (e.g., card type, site handle).
- Save and Test: Publish a test article and check X to confirm the card displays with your profile linked.
For a deep dive, see the System - X Autopost Documentation.
Troubleshooting
- “JSON-LD script not found”: Ensure you’re on an X profile page (e.g., https://x.com/YourUsername), not a tweet or search page. Refresh and try again.
- Clipboard Copy Fails: Some browsers restrict clipboard access unless on HTTPS. Use the basic version or manually copy the ID from the alert.
- No ID Found: Verify the profile is public and the URL is correct.
- Bookmarklet Not Loading: Ensure JavaScript is enabled, or re-drag the link from the Bookmarklet Download Page.