I came across a tool that can dynamically change the image if you change the name at the end of the picture URL.
e.g., https://img1.niftyimages.com/3kw/eoto/qwjd?name=john%20smith
What I would like to do, is send john smith something like
https://website.com?utm_campaign=mike
And Mikes name load up in the meta image.
<meta name="twitter:image" content="https://img1.niftyimages.com/3kw/eoto/qwjd?name=mike" />
I've currently tested this in PHP and Javascript.
PHP:
<?php
$url = "https://img1.niftyimages.com/3kw/eoto/qwjd?name=";
$utm = "utm_campaign";
echo "$url$utm";
?>
<meta name="twitter:image" content="$url$utm" />
Javascript:
<script type="text/javascript">
var url_string = "https://www.first-website.com?utm_campaign=mike"; //window.location.href
var url = new URL(url_string);
var A = url.searchParams.get("utm_campaign");
var B = "https://img1.niftyimages.com/3kw/eoto/qwjd?name=";
var image = B+A;
document.write('<meta name="twitter:image" content="' + image + '" />');
}
})();
</script>
FYI, I'm a complete n00b