mailchimp中的动态链接操作 [英] Dynamic Link Actions in mailchimp

查看:160
本文介绍了mailchimp中的动态链接操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据3种情况进行动态链接开放。如何将其写入链接?




  • 案例1:用户在桌面或Android上。发送用户到网站的链接
    引用内容example.com/content/123

  • 案例2:用户在
    iOS应用程序未安装。发送到应用程序下载,发布下载打开用户点击的
    内容文章

  • 案例3:用户在iOS应用程序上安装了
    。打开带有活动链接的应用程序并链接到该活动的
    应用程序myapp:// content / 123



将其写入可以添加到电子邮件中的HTML源代码中?点击它就必须弄清楚它想做什么。



以下是每个内容项目在mailchimp电子邮件模板中的源代码:

 < span>有关这个地方的简短有趣的描述,在一两句话中... 

< a href =http://example.com/content/123target =_ blank>阅读更多内容< / a>

< / span>

非常感谢您的任何帮助。

解决方案

您正在寻找深层链接的概念。我可以帮你处理你的两件事情。首先,我将解释我将如何尝试做这件事。此示例将打开Facebook应用程序并导航到维基百科页面。您可以尝试在Android或iOS设备上打开此链接


  1. 我不使用电子邮件中的直接链接,而是使用一个链接,然后在服务器端确定要采取的操作。 / li>

在您的电子邮件模板中,执行此操作

 < span>关于这个地方的简短有趣的描述,在一个或两个短语中... 
< a href =http://example.com/my_server_script.phptarget =_ blank >了解详情< / a>
< / span>

这会让用户看到一个名为'my_server_script.php'的脚本(我的例子是PHP,但你可以用任何语言实现这一点)。


  1. 在这个脚本中,你可以检查用户通过使用PHP的 $ _ SERVER ['HTTP_USER_AGENT'] 代理。这会给你类似于 Mozilla / 5.0(Macintosh; U; PPC Mac OS X; en)AppleWebKit / 418(KHTML,如Gecko)Safari / 417.9.3 。然后通过解析这个字符串,你可以确定用户的操作系统并基于此操作。请注意,用户代理字符串可以修改,并不总是100%,但它应该足够您的使用。


  2. 一旦你确定您可以将用户重定向到应用程序,方法是将用户发送到应用程序。


这里是PHP我之前在Android上测试过的代码应该会打开Facebook应用程序并带您进入Wikipedia页面。据我所知,它也应该在iOS上运行。

 <?php 
// Set App deeplink
$ app_url ='fb:// profile / 33138223345';

//尝试将设备重定向到URL
头('Location:'。$ app_url);
?>




  1. 我没有解决方案来检测应用程序是否已安装,但如果您确实找到了
    的解决方案,那么您应该可以使用下面的代码将它们重定向到相应的应用商店。

     <?php 
    // iTunes链接
    $ app_install_link ='https://itunes.apple.com/za/app/facebook/id284882215 ?MT = 8' ;

    //然后将用户重定向到应用商店位置
    header('Location:'。$ app_install_link);
    ?>


  2. 如果您确定应将其发送至桌面版本,请执行

     <?php 
    //浏览器链接
    $ link ='https://example.com/content/ 123' ;

    header('Location:'。$ link);
    ?>


因为你不会有电子邮件本身的功能来检查你在哪个设备上,并根据它来修改链接。



然而,您仍然可以通过

使用深层链接 fb:// profile / 33138223345 >

 < span>有关这个地方的简短有趣的描述,用一两个短语... 
< a href = fb:// profile / 33138223345target =_ blank>阅读更多内容< / a>
< / span>

并且应该在iOS和Android上打开Facebook应用程序。



希望这会有所帮助!


I need to do dynamic link opening based on each of 3 cases. How do I write this into a link ?

  • Case 1: user is on desktop or Android. Send user to website link with reference to content example.com/content/123
  • Case 2: user is on iOS app is not installed. Send to App Download, post download open content article that user tapped on
  • Case 3: user is on iOS app is installed. Open app with activity link and link to that activity in the app myapp://content/123

Any ideas how to write this into an HTML source that I can add to email? On click it will have to figure out what it wants to do.

Here is what the source looks like in mailchimp email template per content item:

<span>A brief funny description about this place, in one or two phrases... 

       <a href="http://example.com/content/123" target="_blank">Read More</a>

    </span>

Any help is greatly appreciated.

解决方案

You are looking for the concept of deep linking. I can help you with 2 of your cases

First I'll explain how I would attempt to make this work. This sample will open the Facebook app and navigate to the Wikipedia page. You can try this out by opening this link from your Android or iOS device.

  1. Instead of having the direct link in the email itself, I'd use one link that would then, on the server's side, determine the action to take.

In your email template, do this

<span>A brief funny description about this place, in one or two phrases... 
   <a href="http://example.com/my_server_script.php" target="_blank">Read More</a>
</span>

This should then take the user to a script named 'my_server_script.php' (my example is PHP, but you can achieve this in any language).

  1. In this script, you can then check the User Agent by using PHP's $_SERVER['HTTP_USER_AGENT']. This will give you something like Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3. Then by parsing this string, you can determine the user's OS and take an action based on that. Please do note that User Agent strings can be modified and is not always 100%, but it should be more than enough for your use.

  2. Once you have determined the action to take, you could redirect the user to the app by sending them to the deeplink.

Here is PHP code I tested on Android earlier, this should open the Facebook app and take you to the Wikipedia page. As far as I know, it should work on iOS as well.

    <?php
    // Set App deeplink
    $app_url = 'fb://profile/33138223345';

    // Try to redirect the device to the URL
    header('Location: ' . $app_url);
    ?>

  1. I don't have a solution for detecting if the app is installed, but if you do find a solution for that, you should be able to redirect them to the appropriate app store using the code below

    <?php
    // iTunes link
    $app_install_link = 'https://itunes.apple.com/za/app/facebook/id284882215?mt=8';
    
    // Then redirect the user to the app store location
    header('Location: ' . $app_install_link);
    ?>
    

  2. If you determine they should be sent to the desktop version, simply do

    <?php
    // Browser link
    $link = 'https://example.com/content/123';
    
    header('Location: ' . $link );
    ?>
    

This is personally how I would make this work since you won't have the capability in the email itself to check what device you are on and modify the link based on that.

You should however still be able to use the deeplink fb://profile/33138223345 by doing

    <span>A brief funny description about this place, in one or two phrases... 
        <a href="fb://profile/33138223345" target="_blank">Read More</a>
    </span>

and that should open the Facebook app on iOS and Android.

Hope this helped a bit!

这篇关于mailchimp中的动态链接操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆